-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Pylint reports ungrouped-imports for TYPE_CHECKING imports #3382
Comments
Sorry, I'm not sure I'm able to reproduce this.
|
Isort reports version |
Just tried reproducing this. With the following code
pylint reports
Then no error is reported. The same applies to other imported modules; When the last import before Versions:
|
Looking at the example given by @developedby, I think it's not a bug, but how
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import List
from logging import Logger In this case, the behavior of the checker from typing import TYPE_CHECKING
if TYPE_CHECKING:
from logging import Logger
from typing import List In this case, the behvaior of the checker Another alternative is to use |
Steps to reproduce
Remove the pylint: disable comment and it will report ungrouped-imports
Current behavior
ungrouped-imports is reported for any duplicate import sources defined in an
if TYPE_CHECKING
block, not including thetyping
module.Expected behavior
Pylint accepts the syntax as it's common to have certain imports in TYPE_CHECKING if not needed at runtime.
pylint --version output
The text was updated successfully, but these errors were encountered: