---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TC002 [*] Move third-party import `pkg.bar.A` into a type-checking block
  --> strict.py:54:25
   |
52 |     # In un-strict mode, this _should_ raise an error, since `pkg.bar` isn't used at runtime
53 |     import pkg
54 |     from pkg.bar import A
   |                         ^
55 |
56 |     def test(value: A):
   |
help: Move into type-checking block
   |
1  | from __future__ import annotations
2  + from typing import TYPE_CHECKING
3  +
4  + if TYPE_CHECKING:
5  +     from pkg.bar import A
6  |
--------------------------------------------------------------------------------
57 |     import pkg
   -     from pkg.bar import A
58 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `pkg` into a type-checking block
  --> strict.py:91:12
   |
89 |     # Note that `pkg` is a prefix of `pkgfoo` which are both different modules. This is
90 |     # testing the implementation.
91 |     import pkg
   |            ^^^
92 |     import pkgfoo.bar as B
   |
help: Move into type-checking block
   |
1  | from __future__ import annotations
2  + from typing import TYPE_CHECKING
3  +
4  + if TYPE_CHECKING:
5  +     import pkg
6  |
--------------------------------------------------------------------------------
94 |     # testing the implementation.
   -     import pkg
95 |     import pkgfoo.bar as B
   |
note: This is an unsafe fix and may change runtime behavior
