ZFS Automatic Snapshot Daemon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
648 B

from typing import Any, Mapping, MutableMapping
_config: MutableMapping[str, Any] = {}
def change(new):
_config.clear()
_config.update(new)
def get(*keys: str, default: Any = None, cursor: Mapping = None):
''' Get configuration value. If multple keys are specified, traverse the
configuration to retrieve the value. If no value was found, return
None. '''
if not cursor:
cursor = _config
first = keys[0]
rest = keys[1:]
value = cursor.get(first)
return (get(rest, default=default, cursor=value)
if value is not None and rest else value)
def reference():
return _config