>>> x in set(['HOUSE', 'CABIN'])
True
+ >>> y = this_location()
+ >>> x == y
+ False
+
"""
- hostname = platform.node()
- if '.house' in hostname:
- location = 'CABIN'
- elif '.cabin' in hostname:
- location = 'HOUSE'
+ this = this_location()
+ if this == 'HOUSE':
+ return 'CABIN'
+ elif this == 'CABIN':
+ return 'HOUSE'
else:
- raise Exception(f"{hostname} doesn't help me know where I'm running?!")
- return location
+ raise Exception(f"{this} doesn't tell me where I'm running?!")
def this_location() -> str:
location = 'HOUSE'
elif '.cabin' in hostname:
location = 'CABIN'
+ elif '.local' in hostname:
+ location = 'HOUSE'
else:
raise Exception(f"{hostname} doesn't help me know where I'm running?!")
return location