Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotted keys values go missing #105

Closed
nat-n opened this issue Aug 3, 2020 · 2 comments · Fixed by #122
Closed

Dotted keys values go missing #105

nat-n opened this issue Aug 3, 2020 · 2 comments · Fixed by #122

Comments

@nat-n
Copy link

nat-n commented Aug 3, 2020

Input:

from tomlkit import parse
parse("""
namespace.key1 = "value1"
namespace.key2 = "value2"
""")

Expected output:

{'namespace': {'key1': 'value1', 'key2': 'value2'}}

Actual output:

{'namespace': {'key1': 'value1'}}

It seems subsequent additions to the subtable via a dotted key are lost.


UPDATE: After further investigation it looks like the bug must be in the TOMLDocument object rather than the parsing logic.

consider:

>>> doc = parse("""
namespace.key1 = "value1"
namespace.key2 = "value2"
""")
>>> repr(doc)
"{'namespace': {'key1': 'value1'}}"
>>> dict(doc)
{'namespace': {'key1': 'value1'}}
>>> str(doc)
"{'namespace': {'key1': 'value1', 'key2': 'value2'}}"
@zhkuo24
Copy link

zhkuo24 commented Dec 17, 2020

suffer the same problem 🤣

@frostming
Copy link
Contributor

I've created a fork of tomlkit v0.7.0 with the issue fixed, try it:

GitHub: https://github.com/frostming/atoml
PyPI: https://pypi.org/project/atoml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants