metann.utils package

Submodules

metann.utils.containers module

class metann.utils.containers.DefaultList(factory=<function _none_fun>, fill=None)[source]

Bases: object

fill(data: collections.abc.Iterable)[source]
class metann.utils.containers.MultipleList(lst)[source]

Bases: object

class metann.utils.containers.SubDict(super_dict: collections.abc.Mapping, keys=[], keep_order=True)[source]

Bases: collections.abc.MutableMapping

Provide a sub dict access to a super dict.

Parameters:
  • super_dict (Mapping) – The super dictionary where you want to take a sub dict
  • keys (iterable) – An iterable of keys according to which you want to access a sub dict
  • keep_order (bool) – If set to true the sub dict will keep the iteration order of the super dict when it is iterated. Default: True

Examples

>>> super_dict = collections.OrderedDict({'a': 1, 'b': 2, 'c': 3})
>>> sub_dict = SubDict(super_dict, keys=['a', 'b'])
update_keys()[source]

This method update the keys of the sub dict when the super dict is modified.

Note

Do not call this method when you use the built-in method only.

Returns:

Module contents

class metann.utils.SubDict(super_dict: collections.abc.Mapping, keys=[], keep_order=True)[source]

Bases: collections.abc.MutableMapping

Provide a sub dict access to a super dict.

Parameters:
  • super_dict (Mapping) – The super dictionary where you want to take a sub dict
  • keys (iterable) – An iterable of keys according to which you want to access a sub dict
  • keep_order (bool) – If set to true the sub dict will keep the iteration order of the super dict when it is iterated. Default: True

Examples

>>> super_dict = collections.OrderedDict({'a': 1, 'b': 2, 'c': 3})
>>> sub_dict = SubDict(super_dict, keys=['a', 'b'])
update_keys()[source]

This method update the keys of the sub dict when the super dict is modified.

Note

Do not call this method when you use the built-in method only.

Returns: