-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Mention implicit export on missing attribute access #13917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Also only suggest public API for attribute access suggestions Fixes python#13908 Accomplishes a similar thing to python#9084 (the logic from there could be improved too, will send a PR for that next)
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: urllib3 (https://github.com/urllib3/urllib3)
- docs/conf.py:55: error: Module has no attribute "__version__" [attr-defined]
+ docs/conf.py:55: error: "Module urllib3" does not explicitly export attribute "__version__" [attr-defined]
streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/watcher/local_sources_watcher_test.py:232:13: error: Module has no attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:232:13: error: "Module streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
- lib/tests/streamlit/watcher/local_sources_watcher_test.py:238:13: error: Module has no attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:238:13: error: "Module streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
- lib/tests/streamlit/watcher/local_sources_watcher_test.py:244:13: error: Module has no attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:244:13: error: "Module streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
- lib/tests/streamlit/watcher/local_sources_watcher_test.py:249:30: error: Module has no attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:249:30: error: "Module streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
- lib/tests/streamlit/watcher/local_sources_watcher_test.py:253:17: error: Module has no attribute "get_default_path_watcher_class" [attr-defined]
+ lib/tests/streamlit/watcher/local_sources_watcher_test.py:253:17: error: "Module streamlit.watcher.local_sources_watcher" does not explicitly export attribute "get_default_path_watcher_class" [attr-defined]
- lib/tests/streamlit/web/server/server_test.py:291:42: error: Module has no attribute "ConfigOption" [attr-defined]
+ lib/tests/streamlit/web/server/server_test.py:291:42: error: "Module streamlit.config" does not explicitly export attribute "ConfigOption" [attr-defined]
|
sobolevn
approved these changes
Oct 19, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error message was very confusing! 👍
hauntsaninja
added a commit
to hauntsaninja/mypy
that referenced
this pull request
Oct 19, 2022
Related to python#13917 and python#13908. This handles situations involving per-module re-exports correctly / is consistent with the error you'd get with attribute access.
hauntsaninja
added a commit
that referenced
this pull request
Oct 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also only suggest public API for attribute access suggestions
Fixes #13908
Accomplishes a similar thing to #9084 (the logic from there could be improved too, will send a PR for that next)