Skip to content

Commit 7abbfaf

Browse files
authored
Require Python 3.12 and use PEP 695 type parameters (#40)
1 parent cc83075 commit 7abbfaf

4 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
28+
python-version: [ "3.12", "3.13", "3.14" ]
2929

3030
steps:
3131
- name: Checkout code
@@ -113,7 +113,7 @@ jobs:
113113
- name: Set up Python
114114
uses: actions/setup-python@v7
115115
with:
116-
python-version: '3.11'
116+
python-version: '3.12'
117117

118118
- name: Build and publish to pypi
119119
uses: JRubics/poetry-publish@v2.1

‎poetry.lock‎

Lines changed: 3 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pyproject.toml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ classifiers = [
1313
"Operating System :: OS Independent",
1414
]
1515

16-
requires-python = ">=3.11"
16+
requires-python = ">=3.12"
1717

1818
dependencies = [
1919
"pycryptodome (>=3.20.0,<4.0.0)",
@@ -158,7 +158,7 @@ max-args = 10
158158

159159
[tool.mypy]
160160
files = ["./src", "./tests"]
161-
python_version = 3.11
161+
python_version = 3.12
162162
show_error_codes = true
163163
strict_equality = true
164164
warn_incomplete_stub = true
@@ -177,7 +177,7 @@ warn_unreachable = true
177177
strict = true
178178

179179
[tool.pylint.MAIN]
180-
py-version = "3.11"
180+
py-version = "3.12"
181181
ignore = ["tests"]
182182
fail-on = ["I"]
183183

‎src/saic_ismart_client_ng/api/base.py‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
Any,
99
ClassVar,
1010
Protocol,
11-
TypeVar,
1211
)
1312

1413
import dacite
@@ -38,7 +37,6 @@ class IsDataclass(Protocol):
3837
# the most reliable way to ascertain that something is a dataclass
3938
__dataclass_fields__: ClassVar[dict[str, Any]]
4039

41-
T = TypeVar("T", bound=IsDataclass)
4240

4341
logger = logging.getLogger(__name__)
4442

@@ -111,7 +109,7 @@ async def login(self) -> LoginResp:
111109
)
112110
return result
113111

114-
async def execute_api_call(
112+
async def execute_api_call[T: IsDataclass](
115113
self,
116114
method: str,
117115
path: str,
@@ -137,7 +135,7 @@ async def execute_api_call(
137135
raise SaicApiException(msg)
138136
return result
139137

140-
async def execute_api_call_with_optional_result(
138+
async def execute_api_call_with_optional_result[T: IsDataclass](
141139
self,
142140
method: str,
143141
path: str,
@@ -179,7 +177,7 @@ async def execute_api_call_no_result(
179177
allow_null_body=True,
180178
)
181179

182-
async def __execute_api_call(
180+
async def __execute_api_call[T: IsDataclass](
183181
self,
184182
method: str,
185183
path: str,
@@ -210,7 +208,7 @@ async def __execute_api_call(
210208
msg = f"API call {method} {path} failed unexpectedly"
211209
raise SaicApiException(msg, return_code=500) from e
212210

213-
async def execute_api_call_with_event_id(
211+
async def execute_api_call_with_event_id[T: IsDataclass](
214212
self,
215213
method: str,
216214
path: str,
@@ -254,7 +252,7 @@ async def execute_api_call_with_event_id_no_result(
254252
delay=delay,
255253
)
256254

257-
async def __execute_api_call_with_event_id(
255+
async def __execute_api_call_with_event_id[T: IsDataclass](
258256
self,
259257
method: str,
260258
path: str,
@@ -286,7 +284,7 @@ async def execute_api_call_with_event_id_inner(*, event_id: str) -> T | None:
286284

287285
return await execute_api_call_with_event_id_inner(event_id="0")
288286

289-
async def __deserialize(
287+
async def __deserialize[T: IsDataclass](
290288
self,
291289
request: httpx.Request,
292290
response: httpx.Response,

0 commit comments

Comments
 (0)