---
source: crates/ruff_linter/src/rules/flake8_type_checking/mod.rs
---
TC004 [*] Move import `datetime` out of type-checking block. Import is used for more than type hinting.
  --> app.py:9:12
   |
 8 | if TYPE_CHECKING:
 9 |     import datetime  # TC004
   |            ^^^^^^^^
10 |     from array import array  # TC004
   |
  ::: app.py:20:25
   |
19 | @app.put("/datetime")
20 | def set_datetime(value: datetime.datetime):
   |                         -------- Used at runtime here
21 |     pass
   |
help: Move out of type-checking block
   |
6  | from fastapi import FastAPI as Api
7  + import datetime
8  |
9  | if TYPE_CHECKING:
   -     import datetime  # TC004
10 |     from array import array  # TC004
   |
note: This is an unsafe fix and may change runtime behavior

TC004 [*] Move import `array.array` out of type-checking block. Import is used for more than type hinting.
  --> app.py:10:23
   |
 8 | if TYPE_CHECKING:
 9 |     import datetime  # TC004
10 |     from array import array  # TC004
   |                       ^^^^^
11 |
12 | app = fastapi.FastAPI("First application")
   |
  ::: app.py:24:20
   |
23 | @app_container.app.get("/array")
24 | def get_array() -> array:
   |                    ----- Used at runtime here
25 |     pass
   |
help: Move out of type-checking block
   |
6  | from fastapi import FastAPI as Api
7  + from array import array
8  |
9  | if TYPE_CHECKING:
10 |     import datetime  # TC004
   -     from array import array  # TC004
11 |
   |
note: This is an unsafe fix and may change runtime behavior
