-
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
Query with TCH00[1-3] and if False
#2408
Comments
Woah, that works? |
Let me think on it 😂 |
I'm reading that I try not to support anything pre-3.7 but I guess in this case it costs me ~nothing to support it. |
Can you verify for me that at least one other type checker (like Pyright or Pyre) respects this? |
Pyre passes on (venv) adam:/mnt/i/Development/Sphinx$ cat bug/bug.py
from __future__ import annotations
if False:
from types import EllipsisType
spam: EllipsisType = ...
(venv) adam:/mnt/i/Development/Sphinx$ pyre --source-directory bug/ check
ƛ No type errors found
(venv311) adam@Gyrostats:/mnt/i/Development/Sphinx$ Pyright passes only with PS I:\Development\sphinx> type bug.py
from __future__ import annotations
if 0:
from types import EllipsisType
spam: EllipsisType = ...
PS I:\Development\sphinx> pyright bug.py
[...elided...]
pyright 1.1.292
0 errors, 0 warnings, 0 informations
Completed in 0.777sec A |
Ruff version 0.0.238.
Sometimes in runtime code I use
if False
to avoid importing fromtyping
if I would only be usingTYPE_CHECKING
. (All three forms pass MyPy.)Ruff reports this as a TCH003 issue, I wonder if
if False
orif 0
could be added to the detection heuristic currently used forif TYPE_CHECKING
?If you'd prefer not to, no worries -- this is easy to add a
# NoQA: TCH00X
comment to.A
The text was updated successfully, but these errors were encountered: