unimport
unimport copied to clipboard
False positives
I have a lot of false conversions, is this a wrong assumption on my part or does it work as intended?
-if __sut__: import pathlib, sys; globals()["__name__"] = "assetdb." + pathlib.Path(__file__).name.replace(".py", ""); sys.path.insert(0, str(pathlib.Path(__file__).absolute().parent.parent))
+if __sut__: import sys; globals()["__name__"] = "assetdb." + pathlib.Path(__file__).name.replace(".py", ""); sys.path.insert(0, str(pathlib.Path(__file__).absolute().parent.parent))
-if __sut__: import doctest, sys; sys.exit(doctest.testmod(optionflags=doctest.ELLIPSIS)[0])
+if __sut__: sys.exit(doctest.testmod(optionflags=doctest.ELLIPSIS)[0])
The pathlib import is removed although it is required here (first use in the module). Same for the doctest import.
Hi, thanks for the issue.
This is a very rare use, there can be many different import uses. Even though Unimport tries to support every use as much as possible, such extremes can happen.
It would be good to keep the issue open for research and reflection.