Dump headers of parent nested tables
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
Hướng nghiên cứu
Start at the tomlkit.dumps(my_dict) entry point and compare its current output with the requested parent-table headers. Determine how the desired formatting could be exposed, then verify the nested apps.test.whatever_1 and apps.test.whatever_2 tables retain their headers and indentation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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) ?
- Ngôn ngữ chính
- Python
- Star
- 850
- Fork
- 163
- Merge trung bình
- 13 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của python-poetry/tomlkit
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
python-poetry/tomlkit#546 · 2 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
python-poetry/tomlkit#603 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
python-poetry/tomlkit#580 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
python-poetry/tomlkit#577 ·
-
Looking for a co-maintainer Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
python-poetry/tomlkit#574 · 5 bình luận ·
Tất cả issue của python-poetry/tomlkit
Issue tương tự
-
[Bug] reef-hermes tells me to resume with hermes --resume, which does not work from my shell Đang mởarea: harness bug status: needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Human-Agent-Society/reef#625 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 80/100
learningequality/kolibri#15351 · 2 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Name consistency Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
eellak/triplestore#65 · 1 bình luận ·