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:
wemake_python_styleguide/logic/arguments/function_args.py:126: error: Argument 1 to "get" of "Mapping" has incompatible type "Optional[Any]"; expected "str"
Simplier repro:
from typing import Mapping, Any, Optional
x: Optional[Any]
m: Mapping[str, int]
m.get(x)
# error: Argument 1 to "get" of "Mapping" has incompatible type "Optional[Any]"; expected "str"
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 be str. So, in my app it was working as expected in all cases: if x is str and exists in m - then fine. If not - then just return None.
I am openning it here, because it looks like a typeshed issue, rather than a mypy issue.
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
Anypart in it, sometimes it can even bestr. So, in my app it was working as expected in all cases: ifxisstrand 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.