Skip to content
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

Redefining aliases that use typing module fails #25

Closed
aklajnert opened this issue Dec 24, 2019 · 0 comments · Fixed by #30
Closed

Redefining aliases that use typing module fails #25

aklajnert opened this issue Dec 24, 2019 · 0 comments · Fixed by #30

Comments

@aklajnert
Copy link

Thanks for this useful tool. Unfortunately while using it I've stumbled upon a weird error.

Consider the following example:

import typing

OPTIONAL_STR = typing.Optional[str]

This is content of example.py and example.pyi. After running retype against them, I get a following error:

example.py: incompatible existing alias 'OPTIONAL_STR'. Expected: 'typing.Optional[str]', actual: 'typing.Optional[str]'

However, when you slightly change the example, everything passes:

from typing import Optional

OPTIONAL_STR = Optional[str]

This behavior is the same for python 3.6, 3.7 and 3.8. Tested on Ubuntu.
Changing imports is a workaround, but it would be nice to use import typing especially if you use this module extensively.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant