Comments from original TOML end up in the wrong spot
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
Direzione di ricerca
Inizia con il riproduttore TOML fornito e traccia le operazioni result.append("rate_limit", route_ratelimit) e route_ratelimit.append("requests", route_ratelimit_requests) sull'array di tabelle analizzato. Conferma perché il secondo commento della route si sposta, quindi assicurati che rimanga immediatamente sopra la seconda voce [[routes]] e riesegui l'esempio per verificare l'output.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 850
- Fork
- 163
- Merge medio
- 13m
- PR unite (30g)
- 2
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python-poetry/tomlkit
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
python-poetry/tomlkit#546 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
python-poetry/tomlkit#603 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
python-poetry/tomlkit#580 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
python-poetry/tomlkit#577 ·
-
Looking for a co-maintainer Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
python-poetry/tomlkit#574 · 5 commenti ·
Tutte le issue di python-poetry/tomlkit
Issue simili
-
bug confirmed issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
open-webui/open-webui#30750 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
good first issue
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100