-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
TCH002 false alarm when importing submodule with import..as #4667
Comments
This seems to be similar to the problem faced in #4655. I'm guessing the submodule import ( |
Oh interesting, it's related but also the reverse. So maybe there's two bugs here that cancel out in the first example, where I don't care to create a dedicated |
Guessing this is a bug in the "strictness" check, whereby we determine whether an import has some other runtime-required import of the same module. |
@dhruvmanila - Do you wanna take a look? I'd start by looking at |
Yeah, sure! |
Thanks for the quick fix! 🚀 |
not using import..as
no errors, working as expected.
using import..as
$ ruff --select --isolated TCH002 foo.py foo.py:3:8: TCH002 Move third-party import `libcst` into a type-checking block Found 1 error.
version
flake8-type-checking
handles both cases, so this is solely a bug in ruff.Popped up in python-trio/flake8-async#196 (comment)
The text was updated successfully, but these errors were encountered: