How to preserve quote style when mutating field?
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从使用 tomlkit 0.12.3 的 Python 复现代码开始,检查解析后的字符串值在修改后如何序列化。根据所示的 data.toml 输入确认该行为,并将完成定义为:修改 bar 并写回后保留原始的单引号样式。
由索引模型根据 Issue 内容生成。
描述
This is the same as https://github.com/sdispater/tomlkit/issues/112 , but I reproduced the issue using the current release (0.12.3). Not sure if it's a bug or if there's an option I don't know about.
Given this code:
import tomlkit
from pathlib import Path
path = Path("data.toml")
path.write_text("""
[foo]
bar = 'baz'
""")
data = tomlkit.parse(path.read_text(encoding="utf-8"))
data["foo"]["bar"] = "quux"
path.write_bytes(tomlkit.dumps(data).encode("utf-8"))
print(path.read_text(encoding="utf-8"))
Output:
[foo]
bar = "quux"
Is it possible to preserve the single quotes when mutating the field?
- 主要语言
- Python
- 星标
- 857
- 派生
- 177
- 平均合并
- 4 天 15 小时
- 30 天内合并 PR
- 9
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-poetry/tomlkit 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
python-poetry/tomlkit#546 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
python-poetry/tomlkit#614 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 68/100
python-poetry/tomlkit#603 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 52/100
python-poetry/tomlkit#580 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 72/100
python-poetry/tomlkit#577 ·
维护者通常 1 天内回复
查看 python-poetry/tomlkit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
conda-forge/conda-build-feedstock#289 · 1 条评论 · 1 个 reaction ·
-
`pulptest` no longer works in 4.0.0: `ImportError: Start directory is not importable: 'pulp/tests'`未关闭
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
TomCasavant/ohio-sites#224 ·