class documentation

class ConfigDict(dict): (source)

View In Hierarchy

A dict-like configuration storage with additional support for namespaces, validators, meta-data, on_change listeners and more. This storage is optimized for fast read access. Retrieving a key or using non-altering dict methods (e.g. `dict.get()`) has no overhead compared to a native dict.

Class Namespace Undocumented
Method __call__ Undocumented
Method __delattr__ Undocumented
Method __delitem__ Undocumented
Method __getattr__ Undocumented
Method __init__ Undocumented
Method __setattr__ Undocumented
Method __setitem__ Undocumented
Method clear Undocumented
Method load_config Load values from an *.ini style config file.
Method load_dict Import values from a dictionary structure. Nesting can be used to represent namespaces.
Method meta_get Return the value of a meta field for a key.
Method meta_list Return an iterable of meta field names defined for a key.
Method meta_set Set the meta field for a key to a new value. This triggers the on-change handler for existing keys.
Method setdefault Undocumented
Method update If the first parameter is a string, all keys are prefixed with this namespace. Apart from that it works just as the usual dict.update(). Example: ``update('some.namespace', key='value')``
Class Variable __slots__ Undocumented
Instance Variable _meta Undocumented
Instance Variable _on_change Undocumented
def __call__(self, *a, **ka): (source)

Undocumented

def __delattr__(self, key): (source)

Undocumented

def __delitem__(self, key): (source)

Undocumented

def __getattr__(self, key): (source)

Undocumented

def __init__(self, *a, **ka): (source)

Undocumented

def __setattr__(self, key, value): (source)

Undocumented

def __setitem__(self, key, value): (source)

Undocumented

def clear(self): (source)

Undocumented

def load_config(self, filename): (source)

Load values from an *.ini style config file. If the config file contains sections, their names are used as namespaces for the values within. The two special sections ``DEFAULT`` and ``bottle`` refer to the root namespace (no prefix).

def load_dict(self, source, namespace='', make_namespaces=False): (source)

Import values from a dictionary structure. Nesting can be used to represent namespaces. >>> ConfigDict().load_dict({'name': {'space': {'key': 'value'}}}) {'name.space.key': 'value'}

def meta_get(self, key, metafield, default=None): (source)

Return the value of a meta field for a key.

def meta_list(self, key): (source)

Return an iterable of meta field names defined for a key.

def meta_set(self, key, metafield, value): (source)

Set the meta field for a key to a new value. This triggers the on-change handler for existing keys.

def setdefault(self, key, value): (source)

Undocumented

def update(self, *a, **ka): (source)

If the first parameter is a string, all keys are prefixed with this namespace. Apart from that it works just as the usual dict.update(). Example: ``update('some.namespace', key='value')``

__slots__: tuple[str, ...] = (source)

Undocumented

Undocumented

_on_change = (source)

Undocumented