Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

build_parameters checks the parameter tree root instead of the parameter

Đang mở Phù hợp với người mới
#3,910 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
82/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Lỗi nằm ở PolicyEngineCountry.build_parameters trong policyengine_api/country.py, nơi elif cuối cùng kiểm tra isinstance(parameters, ParameterNode) trên nút gốc thay vì trên parameter hiện tại. Hãy đọc phần phân nhánh theo kiểu của hàm đó để xác nhận tên biến vòng lặp, sau đó đổi điều kiện để kiểm tra parameter. Xong khi nhánh kiểm tra nút con cháu và các bài kiểm thử hiện có của build_parameters vẫn chạy đạt.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In PolicyEngineCountry.build_parameters (policyengine_api/country.py), the last branch of the type dispatch is:

elif isinstance(parameters, ParameterNode):

parameters is the root tax_benefit_system.parameters, which is always a ParameterNode, so the condition is always true. The intended check is almost certainly isinstance(parameter, ParameterNode) on the current descendant.

Impact

None observed today: every descendant that reaches this branch is a ParameterNode anyway, so the output is the same. But any other descendant type would silently be described as a parameter node instead of being skipped.

Expected

Check parameter, not parameters.

Notes

Found while documenting the code for the ruff docstring rules; behaviour was left unchanged there.

Ngôn ngữ chính
Python
Star
18
Fork
33
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của PolicyEngine/policyengine-api

Tất cả issue của PolicyEngine/policyengine-api

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.