-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[email protected] regression: Argument 1 to "get" of "Mapping" has incompatible type #6597
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
Lines 459 to 462 in 9aa66f0
We should probably change |
The stricter typing for |
I hit this while working on my bidict library, which implements bidirectional mapping data structures which wrap two (regular one-directional) mappings, and which is type hinted and checked with mypy.
I disagree that this indicates a "likely" bug. It could be a bug. But it's just as likely that there is no bug. And the current type annotations are flagging perfectly correct and idiomatic code: Sometimes you have no idea what type Yet these APIs' type hints are treating these APIs the same as Would you accept a PR that changes the Thank you for your consideration. |
I don't think that this is the way forward. Type checkers are supposed to check that the types are correct after all. If you don't know types or are not interested in the extra type checking the annotations provide, you can always use the |
We could probably make it work well enough in practice by special-casing |
I got a new regression from the latest release on a real project: https://github.com/wemake-services/wemake-python-styleguide/blob/master/wemake_python_styleguide/logic/arguments/function_args.py#L125-L126
Error:
Simplier repro:
So, what do you think: is this a valid error? Because it will work at runtime with no problem. And since it has
Any
part in it, sometimes it can even bestr
. So, in my app it was working as expected in all cases: ifx
isstr
and exists inm
- then fine. If not - then just returnNone
.I am openning it here, because it looks like a typeshed issue, rather than a mypy issue.
The text was updated successfully, but these errors were encountered: