Skip to content

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

@jakkdl

Description

@jakkdl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    postponedLow priority, blocked, or similar.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions