devctrl.utility.settings_db.SettingsBackend#

class SettingsBackend[source]#

Bases: Generic[K, S]

Abstract base class for settings backends.

Subclass this to implement custom backends (e.g., network-based).

Methods

load_all

Load all entries from the backend.

save_all

Save all entries to the backend.

__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__': 43, '__doc__': 'Abstract base class for settings backends.\n\nSubclass this to implement custom backends (e.g., network-based).\n', 'load_all': <function SettingsBackend.load_all>, 'save_all': <function SettingsBackend.save_all>, '__static_attributes__': (), '__orig_bases__': (typing.Generic[~K, ~S],), '__dict__': <attribute '__dict__' of 'SettingsBackend' objects>, '__weakref__': <attribute '__weakref__' of 'SettingsBackend' objects>, '__parameters__': (~K, ~S), '__annotations__': {}})#
__firstlineno__ = 43#
classmethod __init_subclass__()#

Function to initialize subclasses.

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

list of weak references to the object

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

Load all entries from the backend.

Returns:

Dictionary mapping keys to serialized settings data

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

Save all entries to the backend.

Parameters:

data – Dictionary mapping keys to serialized settings data