aiida_vasp.utils.extended_dicts#
Extensions of dictionaries.
Extensions of Pythons standard dict as well as Aiida’s AttributeDict.
Module Contents#
Classes#
Extension of the AttributeDict from Aiida.common. |
Functions#
Delete a key from a nested dictionary. |
|
Delete the dictionary entry corresponding to a nested hierarchy of keys. |
|
Updated a nested dictionary, where dict1 is updated with values in dict2. |
|
Utility to update a Dict node in a nested way |
API#
- class aiida_vasp.utils.extended_dicts.DictWithAttributes(dictionary: collections.abc.Mapping[str, Any] | None = None)[source]#
Bases:
aiida.common.extendeddicts.AttributeDictExtension of the AttributeDict from Aiida.common.
This class internally stores values in a dictionary, but exposes the keys also as attributes, i.e. asking for attrdict.key will return the value of attrdict[‘key’] and so on.
If the key is not in the dict a default value will be returned.
Initialization
Recursively turn the dict and all its nested dictionaries into AttributeDict instance.
- aiida_vasp.utils.extended_dicts.delete_keys_from_dict(dictionary: dict[str, Any], keys: str | list[str]) None[source]#
Delete a key from a nested dictionary.
Extended to support somekey.someotherkey in case we need some restrictions on the nesting.
- aiida_vasp.utils.extended_dicts.delete_nested_key(dictionary: dict[str, Any], keys: list[str]) None[source]#
Delete the dictionary entry corresponding to a nested hierarchy of keys.