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:
- candy
SyntacticSugar An object for the removal of the syntax sugar.
- candy
- Returns:
- dictionarydict
Same dictionary without the easy access to the key-value pairs.
- Raises:
- ValueError
If
not isinstance(candy, dict).
See also
Examples
>>> import wulfric >>> atoms = {"names": ["Cr1", "Cr2"]} >>> atoms = wulfric.add_sugar(atoms) >>> atoms.names ['Cr1', 'Cr2'] >>> atoms.positions = [[0, 0, 0], [0.5, 0.5, 0.5]] >>> atoms = wulfric.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]]}