We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This works:
# test.py import os print('PWD: {}'.format(os.environ.get('PWD', '<not set>')))
$ python --version Python 2.7.13 $ python test.py PWD: … $ python3 --version Python 3.6.0 $ python3 test.py PWD: … $ mypy test.py $ mypy --py2 test.py
This fails validation with --py2:
--py2
# test_unicode_literals.py from __future__ import unicode_literals # this is new import os print('PWD: {}'.format(os.environ.get('PWD', '<not set>')))
$ python test_unicode_literals.py PWD: … $ python3 test_unicode_literals.py PWD: … $ mypy test_unicode_literals.py $ mypy --py2 test_unicode_literals.py test_unicode_literals.py:3: error: No overload variant of "get" of "Mapping" matches argument types [builtins.unicode, builtins.unicode]
See stdlib/2/os/__init__.pyi#L67.
stdlib/2/os/__init__.pyi
The text was updated successfully, but these errors were encountered:
This seems to address the issue for Python 2:
# test_unicode_literals_workaound.py from __future__ import unicode_literals import os import typing _EnvironWorkAround = typing.MutableMapping[typing.AnyStr, typing.AnyStr] environ = typing.cast(_EnvironWorkAround, os.environ) print('PWD: {}'.format(environ.get('PWD', '<not set>')))
$ mypy --py2 test_unicode_literals_workaound.py
Sorry, something went wrong.
I'm not sure this is fixable in typeshed. python/mypy#3619 might provide a suitable workaround.
Duplicate of #872.
No branches or pull requests
This works:
This fails validation with
--py2
:See
stdlib/2/os/__init__.pyi
#L67.The text was updated successfully, but these errors were encountered: