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

False positives #292

Open
ArneBachmannDLR opened this issue Jun 1, 2023 · 1 comment
Open

False positives #292

ArneBachmannDLR opened this issue Jun 1, 2023 · 1 comment
Labels
changelog Changes should be written to the changelog file. enhancement New feature or request

Comments

@ArneBachmannDLR
Copy link

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.

@hakancelikdev
Copy link
Owner

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.

@hakancelikdev hakancelikdev added bug Something isn't working enhancement New feature or request changelog Changes should be written to the changelog file. and removed bug Something isn't working labels Jun 1, 2023
@hakancelikdev hakancelikdev moved this to 🆕 New in unimport's backlog Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog Changes should be written to the changelog file. enhancement New feature or request
Projects
Status: 🆕 New
Development

No branches or pull requests

2 participants