Skip to content

Commit 9a6d518

Browse files
committed
**kw_only
1 parent 44d535c commit 9a6d518

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

release_management/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3-
from dataclasses import dataclass
3+
import sys
44
import datetime as dt
5+
from dataclasses import dataclass
56
from pathlib import Path
67

78
try:
@@ -23,14 +24,16 @@
2324
ROOT_DIR = RELEASE_DIR.parent
2425
PEP_ROOT = ROOT_DIR / 'peps'
2526

27+
kw_only = {'kw_only': True} if sys.version_info[:2] >= (3, 10) else {}
28+
2629

27-
@dataclass(frozen=True, kw_only=True, slots=True)
30+
@dataclass(frozen=True, **kw_only, slots=True)
2831
class PythonReleases:
2932
metadata: dict[str, VersionMetadata]
3033
releases: dict[str, list[ReleaseInfo]]
3134

3235

33-
@dataclass(frozen=True, kw_only=True, slots=True)
36+
@dataclass(frozen=True, **kw_only, slots=True)
3437
class VersionMetadata:
3538
"""Metadata for a given interpreter version (MAJOR.MINOR)."""
3639

@@ -49,7 +52,7 @@ def from_toml(cls, data: dict[str, int | str | dt.date]):
4952
return cls(**{k.replace('-', '_'): v for k, v in data.items()})
5053

5154

52-
@dataclass(frozen=True, kw_only=True, slots=True)
55+
@dataclass(frozen=True, **kw_only, slots=True)
5356
class ReleaseInfo:
5457
"""Information about a release."""
5558

0 commit comments

Comments
 (0)