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

Detect attributes from typing alias #48

Closed
davidism opened this issue May 12, 2021 · 2 comments
Closed

Detect attributes from typing alias #48

davidism opened this issue May 12, 2021 · 2 comments

Comments

@davidism
Copy link

davidism commented May 12, 2021

#17 allowed typing.NoReturn instead of NoReturn, but we do import typing as t for a shorter name.

I know this is similar to the typing.overload issue in PyCQA/pyflakes#561. Alternatively, maybe this can be addressed with a config option like typing_namespace = t to change what name the plugin looks for.

I was trying to run this on our projects as someone brought up an issue with the import in 3.6.0, but was surprised to see no errors reported. Not a huge deal, I can just reference the supported list in your code and do it manually for now.

@asottile
Copy link
Owner

I'd rather not, the prevailing convention is to import from typing -- aliasing is a slipperly slope down trying to solve the halting problem (what about import typing; x = typing? what if that's conditional?) -- it's basically intractable

I'd recommend not going against the grain and importing from typing ... directly

@davidism
Copy link
Author

PyCQA/pyflakes#561 (comment) seems relevant here as well. If someone solves it there, maybe we can revisit this.

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

No branches or pull requests

2 participants