wulfric.remove_sugar#

wulfric.remove_sugar(candy: dict) dict[source]#

Takes any dictionary and remove attribute-like access to the key-values to it.

Parameters:
candydict

Dictionary for the addition of the syntax sugar.

Returns:
dictionarydict

Same dictionary without the easy access to the key-value pairs.

Raises:
ValueError

If not isinstance(candy, dict).

Examples

>>> import wulfric as wulf
>>> atoms = {"names" : ["Cr1", "Cr2"]}
>>> atoms = wulf.add_sugar(atoms)
>>> atoms.names
['Cr1', 'Cr2']
>>> atoms.positions = [[0, 0, 0], [0.5, 0.5, 0.5]]
>>> atoms = wulf.remove_sugar(atoms)
>>> atoms.names
Traceback (most recent call last):
...
AttributeError: 'dict' object has no attribute 'names'
>>> atoms
{'names': ['Cr1', 'Cr2'], 'positions': [[0, 0, 0], [0.5, 0.5, 0.5]]}