projects
/
python_utils.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
4d03deb
)
Adds some doctests to site_config.
author
Scott Gasch
<
[email protected]
>
Fri, 4 Feb 2022 20:18:03 +0000
(12:18 -0800)
committer
Scott Gasch
<
[email protected]
>
Fri, 4 Feb 2022 20:18:03 +0000
(12:18 -0800)
site_config.py
patch
|
blob
|
history
diff --git
a/site_config.py
b/site_config.py
index d98c6bc36b8e5671ea581f14dd21f31356debc99..fcf22a8d2cf20d4e6a6dd83690a51de08ce2f44d 100644
(file)
--- a/
site_config.py
+++ b/
site_config.py
@@
-71,6
+71,14
@@
def is_anyone_present_wrapper(location: Location):
def other_location() -> str:
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'
hostname = platform.node()
if '.house' in hostname:
location = 'CABIN'
@@
-82,6
+90,14
@@
def other_location() -> str:
def this_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'
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:
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']
if location_override is None:
try:
location_override = config.config['site_config_override_location']