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-positive F401 when typing is used in comment #6807

Closed
mmhw opened this issue Aug 23, 2023 · 1 comment
Closed

False-positive F401 when typing is used in comment #6807

mmhw opened this issue Aug 23, 2023 · 1 comment

Comments

@mmhw
Copy link

mmhw commented Aug 23, 2023

from typing import List, Callable, Tuple


keys = [
        ('IP', 'ip', str),
        ('Domain', 'domain', str)
]  # type: List[Tuple[str, str, Callable]]

ruff --isolated file.py (0.0.285) gives

file.py:1:20: F401 [*] typing.Callable imported but unused
file.py:1:30: F401 [*] typing.Tuple imported but unused
file.py:1:37: F401 [*] typing.List imported but unused
Found 3 errors.
[*] 3 potentially fixable with the --fix option.

But if i remove the imports and run mypy file.py (1.5.1) i get the following error:

file.py:1: error: Name "List" is not defined [name-defined]
file.py:1: note: Did you forget to import it from "typing"? (Suggestion: "from typing import List")
Found 1 error in 1 file (checked 1 source file)

@charliermarsh
Copy link
Member

I believe this is the same as: #1619.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants