dict_from_parsed
Full name: ase2sprkkr.common.parsing_results.dict_from_parsed
- ase2sprkkr.common.parsing_results.dict_from_parsed(values)[source]
Create a dictionary from the arguments. From duplicate arguments create numpy arrays. Moreover, if there is key of type (a,b), it will be transformed to subdictionary. Such a keys do not allow duplicates.
>>> dict_from_parsed([("x", "y"), ((DictKey("a", 1)), 1), ((DictKey("a", 3)), 2)]) {'x': 'y', 'a': {1: 1, 3: 2}} >>> dict_from_parsed([("x", 1), ("x", "2")]) Traceback (most recent call last): pyparsing.exceptions.ParseException: There are non-unique keys: x >>> dict_from_parsed([(RepeatedKey("x"), 1), (RepeatedKey("x"), 2)]) {'x': [1, 2]}