-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid false-positives for runtime-types in type checking blocks (#2863)
- Loading branch information
1 parent
7be17c5
commit aeae63b
Showing
4 changed files
with
31 additions
and
9 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
crates/ruff/resources/test/fixtures/flake8_type_checking/TCH004_13.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from typing import Final, Literal, TypeAlias | ||
|
||
RatingKey: TypeAlias = Literal["good", "fair", "poor"] | ||
|
||
RATING_KEYS: Final[tuple[RatingKey, ...]] = ("good", "fair", "poor") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...les__flake8_type_checking__tests__runtime-import-in-type-checking-block_TCH004_13.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
source: crates/ruff/src/rules/flake8_type_checking/mod.rs | ||
expression: diagnostics | ||
--- | ||
[] | ||
|