schlichtanders.mydicts module¶
This module mainly collects dictionary subclasses, which are useful to partially modify a dict.
But also a FrozenDict and a convenient update method for updating a dict with another, with options
to specify overwriting/appending flags.
-
class
schlichtanders.mydicts.ComposedDictsView(dict1, dict2, compose_type='stack', if_dict1_empty_iterate_over_dict2=False)[source]¶ Bases:
_abcoll.Mappingcomposes two dictionaries with the given compose method
-
COMPOSE_TYPES= ['stack', 'call', 'use_as_needed', 'defaultto', 'overwrite']¶
-
-
class
schlichtanders.mydicts.DefaultDict(default_getitem=None, default_setitem=None, default_delitem=None, *args, **kwargs)[source]¶ Bases:
dictlike
collections.defaultdict, however default method is called with the accessed key
-
class
schlichtanders.mydicts.FrozenDict(*args, **kwargs)[source]¶ Bases:
_abcoll.MappingThis is a hashable wrapper around a dict interface
-
class
schlichtanders.mydicts.IdentityDict(*args, **kwargs)[source]¶ Bases:
schlichtanders.mydicts.DefaultDictalmost like defaultdict, with the crucial difference that new keys are not added dynamically, but always regenerated
-
class
schlichtanders.mydicts.ModifyDict(base_dict, modify_getitem=<function <lambda>>)[source]¶ Bases:
_abcoll.Mapping
-
class
schlichtanders.mydicts.PassThroughDict(dict_like, *args, **kwargs)[source]¶ Bases:
schlichtanders.mydicts.IdentityDictpostmap which passes everything through model if not further defined