---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
 --> quote2.py:2:44
  |
1 | def f():
2 |     from django.contrib.auth.models import AbstractBaseUser
  |                                            ^^^^^^^^^^^^^^^^
3 |
4 |     def test_remove_inner_quotes_double(self, user: AbstractBaseUser["int"]):
  |
help: Move into type-checking block
  |
  - def f():
1 + from typing import TYPE_CHECKING
2 +
3 + if TYPE_CHECKING:
4 |     from django.contrib.auth.models import AbstractBaseUser
5 + def f():
6 |
  |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:9:44
   |
 8 | def f():
 9 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
10 |
11 |     def test_remove_inner_quotes_single(self, user: AbstractBaseUser['int']):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
12 | def f():
   -     from django.contrib.auth.models import AbstractBaseUser
13 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:16:44
   |
15 | def f():
16 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
17 |
18 |     def test_remove_inner_quotes_mixed(self, user: AbstractBaseUser['int', "str"]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
19 | def f():
   -     from django.contrib.auth.models import AbstractBaseUser
20 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:25:44
   |
23 |     from typing import Annotated, Literal
24 |
25 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
26 |
27 |     def test_literal_annotation_args_contain_quotes(self, type1: AbstractBaseUser[Literal["user", "admin"], Annotated["int", "1", 2]]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
28 |
   -     from django.contrib.auth.models import AbstractBaseUser
29 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:34:44
   |
32 |     from typing import Literal
33 |
34 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
35 |
36 |     def test_union_contain_inner_quotes(self, type1: AbstractBaseUser["int" | Literal["int"]]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
37 |
   -     from django.contrib.auth.models import AbstractBaseUser
38 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:43:44
   |
41 |     from typing import Literal
42 |
43 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
44 |
45 |     def test_inner_literal_mixed_quotes(user: AbstractBaseUser[Literal['user', "admin"]]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
46 |
   -     from django.contrib.auth.models import AbstractBaseUser
47 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:52:44
   |
50 |     from typing import Literal
51 |
52 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
53 |
54 |     def test_inner_literal_single_quote(user: AbstractBaseUser[Literal['int'], str]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
55 |
   -     from django.contrib.auth.models import AbstractBaseUser
56 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:61:44
   |
59 |     from typing import Literal
60 |
61 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
62 |
63 |     def test_mixed_quotes_literal(user: AbstractBaseUser[Literal['user'], "int"]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
64 |
   -     from django.contrib.auth.models import AbstractBaseUser
65 |
   |
note: This is an unsafe fix and may change runtime behavior

TC002 [*] Move third-party import `django.contrib.auth.models.AbstractBaseUser` into a type-checking block
  --> quote2.py:70:44
   |
68 |     from typing import Annotated, Literal
69 |
70 |     from django.contrib.auth.models import AbstractBaseUser
   |                                            ^^^^^^^^^^^^^^^^
71 |
72 |     def test_annotated_literal_mixed_quotes(user: AbstractBaseUser[Annotated[str, "max_length=20", Literal['user', "admin"]]]):
   |
help: Move into type-checking block
   |
1  + from typing import TYPE_CHECKING
2  +
3  + if TYPE_CHECKING:
4  +     from django.contrib.auth.models import AbstractBaseUser
5  | def f():
--------------------------------------------------------------------------------
73 |
   -     from django.contrib.auth.models import AbstractBaseUser
74 |
   |
note: This is an unsafe fix and may change runtime behavior
