Skip to content

Dublicate keys are handled as list #6

Description

@awvwgk

This is invalid HSD in DFTB+ when read as 3r:

OBCCorrection = 1.0
OBCCorrection = 0.8
OBCCorrection = 4.85

Translating it to a python dict by

>>> import hsd
>>> dictbuilder = hsd.HsdDictBuilder()
>>> parser = hsd.HsdParser(eventhandler=dictbuilder)
>>> with open("obc3.hsd", "r") as fobj:
...    parser.feed(fobj)
>>> dictbuilder.hsddict
{'obccorrection' = [1.0, 0.8, 4.85]}

Yields a list instead of an error, the given dict backtranslates to HSD as

>>> print(hsd.dumps(dictbuilder.hsddict))
obccorrection = 1.0 0.8 4.85

Also note that the capitalization is not preserved as in DFTB+.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions