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.
If we are currently updating the contents of
mod1.py
, and a function signature usesmod1.MyClass
as one of it's types, then we should skip searching for an import ofmod1.MyClass
.Right now, this mostly works, because the search for
mod1.MyClass
inside ofmod1
will generally fail - which means it will try to create an import statement... but thenadd_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
.