devctrl.utility.settings_db.YamlFileBackend#

class YamlFileBackend(file_path: str, loader=<class 'yaml.loader.Loader'>)[source]#

Bases: SettingsBackend[K, S]

YAML file-based backend for SettingsDb.

Parameters:
  • file_path – Path to the YAML file

  • loader – YAML loader to use (defaults to yaml.Loader)

Methods

load_all

Load all settings from YAML file.

save_all

Save all settings to YAML file.

__annotations__ = {}#
classmethod __class_getitem__()#

Parameterizes a generic class.

At least, parameterizing a generic class is the main thing this method does. For example, for some generic class Foo, this is called when we do Foo[int] - there, with cls=Foo and params=int.

However, note that this method is also called when defining generic classes in the first place with class Foo[T]: ....

__dict__ = mappingproxy({'__module__': 'devctrl.utility.settings_db', '__firstlineno__': 64, '__doc__': 'YAML file-based backend for SettingsDb.\n\n:param file_path: Path to the YAML file\n:param loader: YAML loader to use (defaults to yaml.Loader)\n', '__init__': <function YamlFileBackend.__init__>, 'load_all': <function YamlFileBackend.load_all>, 'save_all': <function YamlFileBackend.save_all>, '__static_attributes__': ('file_path', 'loader'), '__orig_bases__': (devctrl.utility.settings_db.SettingsBackend[~K, ~S],), '__parameters__': (~K, ~S), '__annotations__': {}})#
__firstlineno__ = 64#
__init__(file_path: str, loader=<class 'yaml.loader.Loader'>)[source]#
classmethod __init_subclass__()#

Function to initialize subclasses.

__module__ = 'devctrl.utility.settings_db'#
__orig_bases__ = (devctrl.utility.settings_db.SettingsBackend[~K, ~S],)#
__parameters__ = (~K, ~S)#
__static_attributes__ = ('file_path', 'loader')#
__weakref__#

list of weak references to the object

load_all() dict[K, dict][source]#

Load all settings from YAML file.

save_all(data: dict[K, dict]) None[source]#

Save all settings to YAML file.