aiida_vasp.utils.extended_dicts#
Extensions of dictionaries.
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. |
|
Find a key in a nested dictionary. |
|
Utility to update a Dict node in a nested way |
API#
- class aiida_vasp.utils.extended_dicts.DictWithAttributes(dictionary=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, keys)[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, keys)[source]#
Delete the dictionary entry corresponding to a nested hierarchy of keys.
- aiida_vasp.utils.extended_dicts.update_nested_dict(dict1: dict, dict2: dict, extend_list: bool = False)[source]#
Updated a nested dictionary, where dict1 is updated with values in dict2.
- aiida_vasp.utils.extended_dicts.find_key_in_dicts(dictionary: dict, supplied_key: str)[source]#
Find a key in a nested dictionary.
- aiida_vasp.utils.extended_dicts.update_nested_dict_node(dict_node: aiida.orm.Dict, update_dict: dict, extend_list: bool = False)[source]#
Utility to update a Dict node in a nested way