-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Calling built-in open() with **args #4302
Comments
Another possible workaround is to give an explicit type for args: Dict[str, Any] maybe it is possible to give a more precise type using |
Here is a minimal repro.
If you change the last argument to be eg, Unfortunately, I'm not sure there is a better alternative than requiring an annotation of |
Thanks. Unfortunately we also need to support Python 3.4 and 3.5 which don't have PEP 526. I'm not sure changing that to if encoding is None:
args = dict(mode='rb') # type: Dict[str, Any]
else:
args = dict(mode='r', encoding=encoding, errors=errors) # type: Dict[str, Any] is better because it means we still have to import |
You can do
|
I believe mypy did the correct thing here, so I am going to close this. If you have further concerns @warsaw, feel free to comment and I'll reopen. |
I have some code that does this:
If I don't include the
# type: ignore
comment, mypy complains:I don't know what if anything can be done about this, short of adding the ignore. I can imagine it's not so easy to support **keywords.
The text was updated successfully, but these errors were encountered: