out of order sections causing issues
还没有人认领这个 Issue。
评估
调研方向
从 issue 中的 reproducer.py 代码开始,使用所示的 TOML 运行它;比较 _insert_after、value_insert_after() 和 content.value。跟踪乱序 section 和 build-system 表的表示方式;当插入 group section 后能生成预期的 TOML 且不出现任何 AttributeError 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
When there are sections defined out of order, it seems tomlkit does not like it. Original issue was reported at https://github.com/python-poetry/poetry/issues/4718.
The following code runs without issues, however does not modify the toml. Using content.value_insert_after() causes AttributeError: 'dict' object has no attribute '_insert_after'.
If we remove build-system from the toml, the code below raises AttributeError: 'Table' object has no attribute '_insert_after'. However using content.value succeeds with the right results.
reproducer.py
import tomlkit
TOML = tomlkit.parse("""\
[tool.poetry]
name = "foobar"
version = "0.1.0"
description = ""
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.plugins]
""")
if __name__ == '__main__':
content = TOML["tool"]["poetry"]
content._insert_after("dependencies", "group", tomlkit.table(is_super_table=True))
content["group"]["one"] = tomlkit.table(is_super_table=True)
content["group"]["one"]["dependencies"] = tomlkit.table()
print(TOML.as_string())
- 主要语言
- Python
- 星标
- 850
- 派生
- 163
- 平均合并
- 13 分钟
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-poetry/tomlkit 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
python-poetry/tomlkit#546 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 68/100
python-poetry/tomlkit#603 ·
-
难度 3/5 1-2 天 新手友好度 52/100
python-poetry/tomlkit#580 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 72/100
python-poetry/tomlkit#577 ·
-
难度 5/5 一周以上 新手友好度 20/100
python-poetry/tomlkit#574 · 5 条评论 ·
查看 python-poetry/tomlkit 的全部 Issue
相似的 Issue
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 90/100