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

Add support for from ... import ... and import ... as ... #132

Open
jakkdl opened this issue Feb 9, 2023 · 1 comment
Open

Add support for from ... import ... and import ... as ... #132

jakkdl opened this issue Feb 9, 2023 · 1 comment
Labels
postponed Low priority, blocked, or similar.

Comments

@jakkdl
Copy link
Member

jakkdl commented Feb 9, 2023

Quick GitHub search gives 850 results for from anyio import ... and 230 results for trio. So seems relatively prevalent?

With the addition of utility visitors / type tracking, it's not technically difficult to add support for different imports and make TRIO106 a relic of the past. Just gotta add a visit function for Import / ImportFrom, save all aliases in a dictionary, and then e.g. trio105 can make a lookup in the dict to see if the thing it's analyzing has been aliased.

It's going to require rewriting a bunch of checks to use it though, who currently have hard-coded values tested against ast.unparse or a stack of isinstance checks. So if implemented before libCST it would probably be a bunch of duplicated effort - so if you think it's a good idea I would vote to delay it for now.

@Zac-HD
Copy link
Member

Zac-HD commented Feb 9, 2023

Let's do it! Later 😁

@jakkdl jakkdl added the postponed Low priority, blocked, or similar. label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
postponed Low priority, blocked, or similar.
Projects
None yet
Development

No branches or pull requests

2 participants