Skip to content

Commit 1a10d6b

Browse files
authored
NO-JIRA: tests(containers): fix a wrongly applied ruff autofix for pydantic (#2752)
1 parent 34d557b commit 1a10d6b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,13 @@ ignore = [
147147
# Allow unused variables when underscore-prefixed.
148148
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
149149

150+
# Don't suggest moving types used in Pydantic models into `if TYPE_CHECKING` import blocks
151+
# https://docs.astral.sh/ruff/settings/#lint_flake8-type-checking_runtime-evaluated-base-classes
152+
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel"]
153+
154+
# https://docs.astral.sh/ruff/settings/#lint_pep8-naming_classmethod-decorators
155+
pep8-naming.classmethod-decorators = ["pydantic.validator"]
156+
150157
# https://docs.astral.sh/ruff/formatter
151158
[tool.ruff.format]
152159
line-ending = "lf"

tests/containers/pydantic_schemas/podman_machine_inspect.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
from __future__ import annotations
22

33
import json
4-
from typing import TYPE_CHECKING
4+
from datetime import datetime
55

66
from pydantic import BaseModel
77

8-
if TYPE_CHECKING:
9-
from datetime import datetime
10-
118

129
class ConfigDir(BaseModel):
1310
Path: str

0 commit comments

Comments
 (0)