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

Failed to delete an item of OutOfOrderTableProxy #383

Open
ninoseki opened this issue Oct 2, 2024 · 0 comments
Open

Failed to delete an item of OutOfOrderTableProxy #383

ninoseki opened this issue Oct 2, 2024 · 0 comments

Comments

@ninoseki
Copy link

ninoseki commented Oct 2, 2024

Hello, first of all, thanks for creating a great library.

I noticed there is a glitch while dealing with OutOfOrderTableProxy. I cannot delete a key via pop.

import tomlkit

text = """
[tool.poetry]
name = "dummy"
version = "0.0.0"
description = ""
authors = []
readme = "README.md"

[tool.poetry-dynamic-versioning]
enable = true

[[tool.poetry.source]]
name = "foo"
url = ""

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.mypy]
ignore_missing_imports = true
"""

doc = tomlkit.parse(text)
tool = doc["tool"]

print(type(tool)) # <class 'tomlkit.container.OutOfOrderTableProxy'>
print(tool.keys()) # KeysView({'poetry': {'source': [{'name': 'foo', 'url': ''}]}, 'poetry-dynamic-versioning': {'enable': True}, 'mypy': {'ignore_missing_imports': True}})

tool.pop("poetry") # tomlkit.exceptions.NonExistentKey: 'Key "poetry" does not exist.'

(Tested with v0.13.2)

Am I misusing something? Or is this a bug in OutOfOrderTableProxy's __delitem__ method?

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

No branches or pull requests

1 participant