Dump headers of parent nested tables
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 38/100
Direzione di ricerca
Parti dal punto di ingresso tomlkit.dumps(my_dict) e confronta il suo output attuale con le intestazioni delle tabelle padre richieste. Determina come potrebbe essere esposta la formattazione desiderata, quindi verifica che le tabelle annidate apps.test.whatever_1 e apps.test.whatever_2 mantengano le proprie intestazioni e l'indentazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hello,
-
I was trying to convert this python dictionnary
my_dict = { "apps": { "test": { "whatever_1": { "date": "2025-12-16", }, "whatever_2": { "date": "2025-12-16", }, }, }, }...to this TOML output:
[apps] [apps.test] [apps.test.whatever_1] date = "2025-12-16" [apps.test.whatever_2] date = "2025-12-16" -
I first had great hopes with:
print(tomlkit.dumps(my_dict))but that outputs
[apps.test.whatever_1] date = "2025-12-16" [apps.test.whatever_2] date = "2025-12-16" -
With a bit of pain, I eventually manage to get the expected output using:
my_dict_new = tomlkit.document() for category_name, apps in my_dict.items(): cat = tomlkit.table(False) for app_name, app_reports in apps.items(): app = tomlkit.table(False).indent(4) for report_name, report_data in app_reports.items(): rep = tomlkit.table(False).indent(4) for key, val in report_data.items(): rep.add(key, val).indent(4) app.append(report_name, rep) cat.append(app_name, app) my_dict_new.append(category_name, cat) print(tomlkit.dumps(my_dict_new))
As this the reverse scenario from #47 and #107 in which the target output here seemed to be the default .dumps() output at the time, I wonder whether there would be a quicker way to access the old behavior again (i.e. dump headers for parent nested headers) ?
- 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
-
area: harness bug status: needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Human-Agent-Society/reef#625 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
learningequality/kolibri#15351 · 2 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Name consistency Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eellak/triplestore#65 · 1 commento ·