Skip to content

check if type we're trying to find is in the current module, before searching for import #3

@pmolodo

Description

@pmolodo

If we are currently updating the contents of mod1.py, and a function signature uses mod1.MyClass as one of it's types, then we should skip searching for an import of mod1.MyClass.

Right now, this mostly works, because the search for mod1.MyClass inside of mod1 will generally fail - which means it will try to create an import statement... but then add_import filters out anything trying to import the current module.

At best, this is inefficient (we don't need to bother searching for mod1.MyClass), and at worst, we might get incorrect results - for instance, if we have modules with "doubled names" - ie, versions.versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions