Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.12", "3.13", "3.14" ]

steps:
- name: Checkout code
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
python-version: '3.12'

- name: Build and publish to pypi
uses: JRubics/poetry-publish@v2.1
Expand Down
9 changes: 3 additions & 6 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ classifiers = [
"Operating System :: OS Independent",
]

requires-python = ">=3.11"
requires-python = ">=3.12"

dependencies = [
"pycryptodome (>=3.20.0,<4.0.0)",
Expand Down Expand Up @@ -158,7 +158,7 @@ max-args = 10

[tool.mypy]
files = ["./src", "./tests"]
python_version = 3.11
python_version = 3.12
show_error_codes = true
strict_equality = true
warn_incomplete_stub = true
Expand All @@ -177,7 +177,7 @@ warn_unreachable = true
strict = true

[tool.pylint.MAIN]
py-version = "3.11"
py-version = "3.12"
ignore = ["tests"]
fail-on = ["I"]

Expand Down
14 changes: 6 additions & 8 deletions src/saic_ismart_client_ng/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
Any,
ClassVar,
Protocol,
TypeVar,
)

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

T = TypeVar("T", bound=IsDataclass)

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -111,7 +109,7 @@ async def login(self) -> LoginResp:
)
return result

async def execute_api_call(
async def execute_api_call[T: IsDataclass](
self,
method: str,
path: str,
Expand All @@ -137,7 +135,7 @@ async def execute_api_call(
raise SaicApiException(msg)
return result

async def execute_api_call_with_optional_result(
async def execute_api_call_with_optional_result[T: IsDataclass](
self,
method: str,
path: str,
Expand Down Expand Up @@ -179,7 +177,7 @@ async def execute_api_call_no_result(
allow_null_body=True,
)

async def __execute_api_call(
async def __execute_api_call[T: IsDataclass](
self,
method: str,
path: str,
Expand Down Expand Up @@ -210,7 +208,7 @@ async def __execute_api_call(
msg = f"API call {method} {path} failed unexpectedly"
raise SaicApiException(msg, return_code=500) from e

async def execute_api_call_with_event_id(
async def execute_api_call_with_event_id[T: IsDataclass](
self,
method: str,
path: str,
Expand Down Expand Up @@ -254,7 +252,7 @@ async def execute_api_call_with_event_id_no_result(
delay=delay,
)

async def __execute_api_call_with_event_id(
async def __execute_api_call_with_event_id[T: IsDataclass](
self,
method: str,
path: str,
Expand Down Expand Up @@ -286,7 +284,7 @@ async def execute_api_call_with_event_id_inner(*, event_id: str) -> T | None:

return await execute_api_call_with_event_id_inner(event_id="0")

async def __deserialize(
async def __deserialize[T: IsDataclass](
self,
request: httpx.Request,
response: httpx.Response,
Expand Down
Loading