Cannot determine type of "userlist"
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 20.6k
- Fork
- 3.3k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
Bug Report
Unexpected error Cannot determine type of "userlist". Needs a cyclic import to happen.
To Reproduce
foo.py
import bar
class Foo:
def __init__(self) -> None:
self.view_selector = object()
bar.py
from foo import Foo
class ServerView:
def __init__(self) -> None:
print(ChannelView().userlist)
self.view_id = str(Foo().view_selector)
class ChannelView:
def __init__(self) -> None:
print(ServerView().view_id)
self.userlist = object()
Expected Behavior
no error, or an error that does not confusingly go away when I delete a seemingly unrelated line of code
Actual Behavior
$ python3 -m mypy foo.py bar.py
bar.py:5: error: Cannot determine type of "userlist"
Found 1 error in 1 file (checked 2 source files)
Your Environment
- Mypy version used: master (053a1beb94ee4e5b3260725594315d1b6776e42f)
- Mypy command-line flags: none
- Mypy configuration options from
mypy.ini(and other config files): none - Python version used: doesn't matter, why do you ask?
- Operating system and version: is a weird question to ask. I am tired of answering this question. But I guess it could be useful in some other issue.
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.
Hướng nghiên cứu
Bắt đầu bằng cách chạy python3 -m mypy foo.py bar.py trên ví dụ import vòng được cung cấp và so sánh lỗi userlist với hành vi mong đợi. Theo dõi cách mypy phân tích các định nghĩa Foo, ServerView và ChannelView trong foo.py và bar.py; được xem là hoàn tất khi ví dụ không còn tạo ra lỗi gây nhầm lẫn Cannot determine type of "userlist" hoặc báo cáo một chẩn đoán rõ ràng hơn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- tooling
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100