Comments from original TOML end up in the wrong spot
まだ誰も着手していません。
評価
調査の方向性
提供されたTOML再現例から始め、解析されたテーブルの配列に対する result.append("rate_limit", route_ratelimit) と route_ratelimit.append("requests", route_ratelimit_requests) の操作を追跡します。2番目のルートコメントが移動する理由を確認し、その後、それが2番目の [[routes]] エントリのすぐ上に残ることを確認して、例を再実行して出力を検証します。
索引モデルが issue の本文から書いたものです。
説明
Hello,
I am using the tomlkit Python library to modify an existing TOML file.
The original file looks like this:
## My POST route comment
[[routes]]
method = 'POST'
path = '/my/post/path'
topic = 'my-topic.0'
## My GET route comment
[[routes]]
method = 'GET'
path = '/my/get/path/{key}'
topic = 'my-topic.1'
I add two tables to that original array of tables "[[routes]]", with method = 'POST' and path = '/my/post/path'. When I do that, the resulting file becomes:
## My POST route comment
[[routes]]
method = 'POST'
path = '/my/post/path'
topic = 'my-topic.0'
## My GET route comment
[routes.rate_limit]
enabled = true
[routes.rate_limit.requests]
per_second = 25
[[routes]]
method = 'GET'
path = '/my/get/path/{key}'
topic = 'my-topic.1'
The comment ends up in the wrong spot. What can I do to make sure it stays on top of my second "[[routes]]" such as:
## My POST route comment
[[routes]]
method = 'POST'
path = '/my/post/path'
topic = 'my-topic.0'
[routes.rate_limit]
enabled = true
[routes.rate_limit.requests]
per_second = 25
## My GET route comment
[[routes]]
method = 'GET'
path = '/my/get/path/{key}'
topic = 'my-topic.1'
This is an extract of the code I use to add my 2 tables:
# result is <class 'tomlkit.items.Table'>
route_ratelimit = tomlkit.table()
route_ratelimit.add("enabled", True)
route_ratelimit_requests = tomlkit.table()
route_ratelimit_requests.add("per_second", 25)
result.append("rate_limit", route_ratelimit)
route_ratelimit.append("requests", route_ratelimit_requests)
Thank you for your assistance.
- 主要言語
- Python
- スター
- 850
- フォーク
- 163
- 平均マージ
- 13分
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 1週間以上 初心者へのやさしさ 20/100
python-poetry/tomlkit#574 · コメント 5 件 ·
python-poetry/tomlkit の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
browser-use/browser-use#5905 ·
-
type: enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ynput/ayon-python-api#363 ·
-
bug needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
modelscope/FunASR#3728 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
open-compass/opencompass#2655 ·