-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat return type of
singledispatch
as runtime-required (#13957)
## Summary fixes: #13955 ## Test Plan Update existing test case to use a return type hint for which `main` flags `TCH003`.
- Loading branch information
1 parent
74cf66e
commit ec6208e
Showing
3 changed files
with
33 additions
and
28 deletions.
There are no files selected for viewing
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
32 changes: 16 additions & 16 deletions
32
...rules__flake8_type_checking__tests__typing-only-third-party-import_singledispatch.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 |
---|---|---|
@@ -1,25 +1,25 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs | ||
--- | ||
singledispatch.py:11:20: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | ||
singledispatch.py:12:20: TCH002 [*] Move third-party import `pandas.DataFrame` into a type-checking block | ||
| | ||
9 | from numpy.typing import ArrayLike | ||
10 | from scipy.sparse import spmatrix | ||
11 | from pandas import DataFrame | ||
10 | from numpy.typing import ArrayLike | ||
11 | from scipy.sparse import spmatrix | ||
12 | from pandas import DataFrame | ||
| ^^^^^^^^^ TCH002 | ||
12 | | ||
13 | if TYPE_CHECKING: | ||
13 | | ||
14 | if TYPE_CHECKING: | ||
| | ||
= help: Move into type-checking block | ||
|
||
ℹ Unsafe fix | ||
8 8 | from numpy import asarray | ||
9 9 | from numpy.typing import ArrayLike | ||
10 10 | from scipy.sparse import spmatrix | ||
11 |-from pandas import DataFrame | ||
12 11 | | ||
13 12 | if TYPE_CHECKING: | ||
13 |+ from pandas import DataFrame | ||
14 14 | from numpy import ndarray | ||
15 15 | | ||
16 16 | | ||
9 9 | from numpy import asarray | ||
10 10 | from numpy.typing import ArrayLike | ||
11 11 | from scipy.sparse import spmatrix | ||
12 |-from pandas import DataFrame | ||
13 12 | | ||
14 13 | if TYPE_CHECKING: | ||
14 |+ from pandas import DataFrame | ||
15 15 | from numpy import ndarray | ||
16 16 | | ||
17 17 | |