3939 if getattr(pydantic, "__version__", "1.").startswith("1."):
4040 raise ImportError # noqa: TRY301
4141
42- # YORE: EOL 3.9: Remove block.
43- if sys.version_info < (3, 10):
44- try:
45- import eval_type_backport # noqa: F401
46- except ImportError:
47- _logger.debug(
48- "Pydantic needs the `eval-type-backport` package to be installed "
49- "for modern type syntax to work on Python 3.9. "
50- "Deactivating Pydantic validation for Python handler options.",
51- )
52- raise
53-
5442 from inspect import cleandoc
5543
5644 from pydantic import Field as BaseField
@@ -87,14 +75,7 @@ def _Field(*args: Any, **kwargs: Any) -> None: # type: ignore[misc] # noqa: N8
8775 from collections.abc import MutableMapping
8876
8977
90- # YORE: EOL 3.9: Remove block.
91- _dataclass_options = {"frozen": True}
92- if sys.version_info >= (3, 10):
93- _dataclass_options["kw_only"] = True
94-
95-
96- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
97- @dataclass(**_dataclass_options) # type: ignore[call-overload]
78+ @dataclass(frozen=True, kw_only=True)
9879class GoogleStyleOptions:
9980 """Google style docstring options."""
10081
@@ -205,8 +186,7 @@ class GoogleStyleOptions:
205186 ] = True
206187
207188
208- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
209- @dataclass(**_dataclass_options) # type: ignore[call-overload]
189+ @dataclass(frozen=True, kw_only=True)
210190class NumpyStyleOptions:
211191 """Numpy style docstring options."""
212192
@@ -256,8 +236,7 @@ class NumpyStyleOptions:
256236 ] = True
257237
258238
259- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
260- @dataclass(**_dataclass_options) # type: ignore[call-overload]
239+ @dataclass(frozen=True, kw_only=True)
261240class SphinxStyleOptions:
262241 """Sphinx style docstring options."""
263242
@@ -289,8 +268,7 @@ class SphinxStyleOptions:
289268 ] = True
290269
291270
292- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
293- @dataclass(**_dataclass_options) # type: ignore[call-overload]
271+ @dataclass(frozen=True, kw_only=True)
294272class PerStyleOptions:
295273 """Per style options."""
296274
@@ -333,8 +311,7 @@ def from_data(cls, **data: Any) -> Self:
333311 return cls(**data)
334312
335313
336- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
337- @dataclass(**_dataclass_options) # type: ignore[call-overload]
314+ @dataclass(frozen=True, kw_only=True)
338315class AutoStyleOptions:
339316 """Auto style docstring options."""
340317
@@ -382,8 +359,7 @@ def from_data(cls, **data: Any) -> Self:
382359 return cls(**data)
383360
384361
385- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
386- @dataclass(**_dataclass_options) # type: ignore[call-overload]
362+ @dataclass(frozen=True, kw_only=True)
387363class SummaryOption:
388364 """Summary option."""
389365
@@ -433,8 +409,7 @@ class SummaryOption:
433409 ] = False
434410
435411
436- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
437- @dataclass(**_dataclass_options) # type: ignore[call-overload]
412+ @dataclass(frozen=True, kw_only=True)
438413class PythonInputOptions:
439414 """Accepted input options."""
440415
@@ -1067,8 +1042,7 @@ def from_data(cls, **data: Any) -> Self:
10671042 return cls(**cls.coerce(**data))
10681043
10691044
1070- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
1071- @dataclass(**_dataclass_options) # type: ignore[call-overload]
1045+ @dataclass(frozen=True, kw_only=True)
10721046class PythonOptions(PythonInputOptions): # type: ignore[override,unused-ignore]
10731047 """Final options passed as template context."""
10741048
@@ -1093,8 +1067,7 @@ def coerce(cls, **data: Any) -> MutableMapping[str, Any]:
10931067 return super().coerce(**data)
10941068
10951069
1096- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
1097- @dataclass(**_dataclass_options) # type: ignore[call-overload]
1070+ @dataclass(frozen=True, kw_only=True)
10981071class Inventory:
10991072 """An inventory."""
11001073
@@ -1127,8 +1100,7 @@ def _config(self) -> dict[str, Any]:
11271100 return {"base_url": self.base_url, "domains": self.domains}
11281101
11291102
1130- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
1131- @dataclass(**_dataclass_options) # type: ignore[call-overload]
1103+ @dataclass(frozen=True, kw_only=True)
11321104class PythonInputConfig:
11331105 """Python handler configuration."""
11341106
@@ -1170,8 +1142,7 @@ def from_data(cls, **data: Any) -> Self:
11701142 return cls(**cls.coerce(**data))
11711143
11721144
1173- # YORE: EOL 3.9: Replace `**_dataclass_options` with `frozen=True, kw_only=True` within line.
1174- @dataclass(**_dataclass_options) # type: ignore[call-overload]
1145+ @dataclass(frozen=True, kw_only=True)
11751146class PythonConfig(PythonInputConfig): # type: ignore[override,unused-ignore]
11761147 """Python handler configuration."""
11771148
0 commit comments