summaryrefslogtreecommitdiff
path: root/site_config.py
diff options
context:
space:
mode:
authorScott Gasch <[email protected]>2022-02-04 12:18:03 -0800
committerScott Gasch <[email protected]>2022-02-04 12:18:03 -0800
commit95cff312b239bea10e8adbffd1586e42472bf9e9 (patch)
tree7774f3fb55d31d4120024e7f77317140bfe58f2a /site_config.py
parent4d03debb5b84b5b3e096add468ecd87c55ed0f5f (diff)
Adds some doctests to site_config.
Diffstat (limited to 'site_config.py')
-rw-r--r--site_config.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/site_config.py b/site_config.py
index d98c6bc..fcf22a8 100644
--- a/site_config.py
+++ b/site_config.py
@@ -71,6 +71,14 @@ def is_anyone_present_wrapper(location: Location):
def other_location() -> str:
+ """
+ Returns the location where this program is _NOT_ running.
+
+ >>> x = other_location()
+ >>> x in set(['HOUSE', 'CABIN'])
+ True
+
+ """
hostname = platform.node()
if '.house' in hostname:
location = 'CABIN'
@@ -82,6 +90,14 @@ def other_location() -> str:
def this_location() -> str:
+ """
+ Returns the location where this program _IS_ running.
+
+ >>> x = this_location()
+ >>> x in set(['HOUSE', 'CABIN'])
+ True
+
+ """
hostname = platform.node()
if '.house' in hostname:
location = 'HOUSE'
@@ -93,6 +109,17 @@ def this_location() -> str:
def effective_location(location_override: Optional[str] = None) -> str:
+ """Detects and returns a location taking into account two override
+ mechanisms.
+
+ >>> x = effective_location()
+ >>> x in set(['HOUSE', 'CABIN'])
+ True
+
+ >>> effective_location('HOUSE')
+ 'HOUSE'
+
+ """
if location_override is None:
try:
location_override = config.config['site_config_override_location']