You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[flake8-type-checking] Add sub-diagnostic showing the runtime use of an annotation (TC004) (#23091)
## Summary
<!-- What's the purpose of the change? What does it do, and why? -->
Part of #17203, have not changed `ImportBinding`
#16490 (comment)
## Test Plan
<!-- How was it tested? -->
Updated snapshots.
---------
Signed-off-by: Bhuminjay <bhuminjaysoni@gmail.com>
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__quote_runtime-import-in-type-checking-block_quote.py.snap
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ TC004 [*] Move import `pandas.DataFrame` out of type-checking block. Import is u
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_1.py.snap
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ TC004 [*] Move import `datetime.datetime` out of type-checking block. Import is
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_11.py.snap
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ TC004 [*] Move import `typing.List` out of type-checking block. Import is used f
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_12.py.snap
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@ TC004 [*] Move import `collections.abc.Callable` out of type-checking block. Imp
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_17.py.snap
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_TC004_2.py.snap
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,12 @@ TC004 [*] Move import `datetime.date` out of type-checking block. Import is used
Copy file name to clipboardExpand all lines: crates/ruff_linter/src/rules/flake8_type_checking/snapshots/ruff_linter__rules__flake8_type_checking__tests__runtime-import-in-type-checking-block_module__app.py.snap
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,13 @@ TC004 [*] Move import `datetime` out of type-checking block. Import is used for
9
9
|^^^^^^^^
10
10
10|fromarrayimportarray # TC004
11
11
|
12
+
::: app.py:20:25
13
+
|
14
+
19| @app.put("/datetime")
15
+
20|defset_datetime(value: datetime.datetime):
16
+
|--------Usedatruntimehere
17
+
21|pass
18
+
|
12
19
help: Moveoutoftype-checkingblock
13
20
4|
14
21
5|importfastapi
@@ -32,6 +39,13 @@ TC004 [*] Move import `array.array` out of type-checking block. Import is used f
0 commit comments