|
|
|
@ -119,7 +119,7 @@ def clear():
|
|
|
|
|
_config.clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get(path, key, default=None, *, conf=_config):
|
|
|
|
|
def get(path, key, default=None, conf=_config):
|
|
|
|
|
"""Get the value of property 'key' or a default value"""
|
|
|
|
|
try:
|
|
|
|
|
for p in path:
|
|
|
|
@ -129,7 +129,7 @@ def get(path, key, default=None, *, conf=_config):
|
|
|
|
|
return default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def interpolate(path, key, default=None, *, conf=_config):
|
|
|
|
|
def interpolate(path, key, default=None, conf=_config):
|
|
|
|
|
"""Interpolate the value of 'key'"""
|
|
|
|
|
if key in conf:
|
|
|
|
|
return conf[key]
|
|
|
|
@ -143,7 +143,7 @@ def interpolate(path, key, default=None, *, conf=_config):
|
|
|
|
|
return default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def interpolate_common(common, paths, key, default=None, *, conf=_config):
|
|
|
|
|
def interpolate_common(common, paths, key, default=None, conf=_config):
|
|
|
|
|
"""Interpolate the value of 'key'
|
|
|
|
|
using multiple 'paths' along a 'common' ancestor
|
|
|
|
|
"""
|
|
|
|
@ -175,7 +175,7 @@ def interpolate_common(common, paths, key, default=None, *, conf=_config):
|
|
|
|
|
return default
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def accumulate(path, key, *, conf=_config):
|
|
|
|
|
def accumulate(path, key, conf=_config):
|
|
|
|
|
"""Accumulate the values of 'key' along 'path'"""
|
|
|
|
|
result = []
|
|
|
|
|
try:
|
|
|
|
@ -194,7 +194,7 @@ def accumulate(path, key, *, conf=_config):
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set(path, key, value, *, conf=_config):
|
|
|
|
|
def set(path, key, value, conf=_config):
|
|
|
|
|
"""Set the value of property 'key' for this session"""
|
|
|
|
|
for p in path:
|
|
|
|
|
try:
|
|
|
|
@ -204,7 +204,7 @@ def set(path, key, value, *, conf=_config):
|
|
|
|
|
conf[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def setdefault(path, key, value, *, conf=_config):
|
|
|
|
|
def setdefault(path, key, value, conf=_config):
|
|
|
|
|
"""Set the value of property 'key' if it doesn't exist"""
|
|
|
|
|
for p in path:
|
|
|
|
|
try:
|
|
|
|
@ -214,7 +214,7 @@ def setdefault(path, key, value, *, conf=_config):
|
|
|
|
|
return conf.setdefault(key, value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def unset(path, key, *, conf=_config):
|
|
|
|
|
def unset(path, key, conf=_config):
|
|
|
|
|
"""Unset the value of property 'key'"""
|
|
|
|
|
try:
|
|
|
|
|
for p in path:
|
|
|
|
|