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

pytype doesn't support aliasing an import from a class in pyi files (seen in pynamodb.models stub) #316

Closed
rchen152 opened this issue May 15, 2019 · 1 comment
Labels
bug cat: stubs and 3p type stubs and third-party types

Comments

@rchen152
Copy link
Contributor

pytype doesn't support the following:

from .exceptions import DoesNotExist as DoesNotExist
class Model(metaclass=MetaModel):
    DoesNotExist = DoesNotExist

seen in third_party/2and3/pynamodb/models.pyi.
This is because pytype only allows aliases to point to attributes on the same class. We can either fix this in our parser or change the alias to a constant (DoesNotExist: Type[DoesNotExist]), although that decreases readability and might confuse other type checkers.

@rchen152
Copy link
Contributor Author

This seems to be fixed now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cat: stubs and 3p type stubs and third-party types
Projects
None yet
Development

No branches or pull requests

1 participant