Comments from original TOML end up in the wrong spot
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với trình tái hiện TOML được cung cấp và theo dõi các thao tác result.append("rate_limit", route_ratelimit) và route_ratelimit.append("requests", route_ratelimit_requests) trên mảng bảng đã được phân tích. Xác nhận lý do chú thích route thứ hai bị di chuyển, sau đó đảm bảo rằng nó vẫn nằm ngay phía trên mục [[routes]] thứ hai và chạy lại ví dụ để xác minh đầu ra.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- 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
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
xinnan-tech/xiaozhi-fde-talk#263 ·
-
rules
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
huggingface/Repo2RLEnv#163 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
huggingface/sentence-transformers#4074 ·
-
comp/dashboard invalid P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
NousResearch/hermes-agent#121143 ·