Add option to select scope for doctests
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
- 45/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- testing-qa, tooling
Hướng nghiên cứu
Start with the test.py reproducer in the issue and run pyflakes against it, then inspect how doctest code is analyzed. Add a selectable scope for doctests so imports in doctest scope do not produce false redefinition warnings, while genuine unused-import warnings remain; verify the reported output and the SymPy example.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Original report by asmeurer (@asmeurer?) on Launchpad:
test.py:
import sys
import sys
def func():
"""
A docstring
>>> import sys
>>> sys.path
"""
return 1
The pyflakes output is
test.py:1: 'sys' imported but unused
test.py:6: redefinition of unused 'sys' from line 1
The line 6 "redefinition of unused 'sys' from line 1" is incorrect, because the doctest scope is separate from the module scope.
I can't figure out how to reproduce it with a small file, but in this file: https://github.com/sympy/sympy/blob/master/sympy/physics/mechanics/functions.py, the output is
sympy/physics/mechanics/functions.py:160: redefinition of unused 'diff' from line 27
sympy/physics/mechanics/functions.py:200: redefinition of unused 'dynamicsymbols' from line 19
sympy/physics/mechanics/functions.py:261: redefinition of unused 'dynamicsymbols' from line 19
sympy/physics/mechanics/functions.py:458: redefinition of unused 'Point' from line 26
sympy/physics/mechanics/functions.py:508: redefinition of unused 'Point' from line 26
That is, it complains about the imports in the doctests, but not the imports themselves (because they actually are used in the file).
- Ngôn ngữ chính
- Python
- Star
- 1.5k
- Fork
- 205
- Merge trung bình
- 1 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 PyCQA/pyflakes
-
F542 is not a crimeĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
setuptools deprecation warningsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 52/100
-
Use of await in a function that is not async should be shown as a syntax error by flake8Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Tất cả issue của PyCQA/pyflakes
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
micropython/micropython#19906 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
FinanceFlash/unvibecode#597 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
TomAnthony/YourOwnWeigh#21 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: Compliance rules never see Unity Catalog views as viewsCó thể đã có người làm @wagnercsantos đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
databrickslabs/ontos#1348 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Deprecated datetime.utcnow() is called on every log line (DeprecationWarning on Python 3.12+)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày