Running with --disallow-any-expr errors on exprs from "unfollowed code" even with immediate cast / assignment.
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
- 35/100
Hướng nghiên cứu
Reproduce the report using the command mypy --disallow-any-expr and the example in scratch_6.py, then compare the observed diagnostics with the linked command-line documentation. Trace how expressions from unfollowed imports are handled in the cast and annotated-assignment cases; done means both forms no longer produce the reported errors when their result is explicitly typed.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Run mypy 0.580 on the following code with the flag:
mypy --disallow-any-expr
from typing import cast
import numpy as np # type: ignore
class C: ...
a = cast(C, np.array([1,2,3]))
b: C = np.array([1,2,3])
This yields the errors:
scratch_6.py:7: error: Expression has type "Any"
scratch_6.py:8: error: Expression has type "Any"
One each for the cast and assignment forms.
According to the docs on --disallow-any-expr (http://mypy.readthedocs.io/en/latest/command_line.html). I believe both the cast and the assignment to a typed variable should resolve the errors.
Note that I'm using numpy as my "unfollowed import" here, but the problem seems to occur with other "unfollowed" libraries I've tried as well. Substitute as convenient.
- Ngôn ngữ chính
- Python
- Star
- 20.6k
- Fork
- 3.3k
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 54
Hướng dẫn đóng góp
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/mypy
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug topic-configuration topic-error-reporting
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
zostera/django-bootstrap4#894 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
use-agent-os/agent-os#3276 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
zephyrproject-rtos/zephyr#119726 ·
-
area/auth bug comp/agent P3 platform/discord type/security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
NousResearch/hermes-agent#117848 ·