-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add flag prohibiting annotation by Any resulting from an unanalyzed module #3205
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
Comments
This is intentional. Everything non-annotated/unknown should have type For more control on mypy behaviour, you could use flags, for example:
I am closing this, since this is unlikely to change. Feel free to re-open if you have additional concerns. |
so I understand that it is expected for unchecked imports to be Any - but what I did not expect is that we could use one of them as a type without any warning. It doesn't sound like any of those flags you are suggesting will fix this? Can we please reopen? (It doesn't look like I have the ability to do this myself) anyhow I filed this task at the suggestion of @ddfisher, who thought a flag for a warning about this could be valuable |
Yes, this case is not covered by current flags. And it looks like such flag is not too difficult to implement. |
(assigning to myself to hold for @ilinum) |
As some additional background, this happens when the To implement this, I'd start by adding an additional member to the |
These types can appear from an unanalyzed module. If mypy encounters a type annotation that uses such a type, it will report an error. Fixes python#3205
These types can appear from an unanalyzed module. If mypy encounters a type annotation that uses such a type, it will report an error. Fixes python#3205
These types can appear from an unanalyzed module. If mypy encounters a type annotation that uses such a type, it will report an error. Fixes python#3205
example code, in py2.7
I would expect this to be an error: if mypy doesn't know what
MyType
is, it shouldn't be a valid type. Instead, it assumes it'sAny
which is way more permissive behavior than I expect.The text was updated successfully, but these errors were encountered: