Skip to content

dict key string portions are dropped, or extra quotes added #335

Description

@nmz787-intel

pyhocon version 0.3.60

example code trying to load a dict:

from pyhocon import ConfigFactory

my_dict = {
    "myStuff": {
        "myThing_r0.1": ["someVal"],
    }
}

cfg = ConfigFactory.from_dict(my_dict)

print(f"expectation:\n{my_dict['myStuff'].keys()}")
print(f"actual:\n{cfg['myStuff'].keys()}")

output:

expectation:
dict_keys(['myThing_r0.1'])
actual:
odict_keys(['myThing_r0'])

you can see the .1 got dropped from the key.




In another attempt, to replicate loading a settings file:

from pyhocon import ConfigFactory

my_dict_str = """{
    "myStuff": {
        "myThing_r0.1": ["someVal"],
    }
}
"""

cfg = ConfigFactory.parse_string(my_dict_str)

print(f"actual:\n{cfg['myStuff'].keys()}")

the output is:

actual:
odict_keys(['"myThing_r0.1"'])

and you can see extra quotes getting added

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions