Skip to content

Commit 18ffe68

Browse files
author
mcdax
committed
fix: Resolve mypy type checking errors
1 parent 95f8ad9 commit 18ffe68

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

comdirect_client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import time
77
import uuid
88
from datetime import datetime, timedelta
9-
from typing import Any, Callable, Optional
9+
from typing import Any, Callable, Optional, cast, cast
1010

1111
import httpx
1212

@@ -214,7 +214,7 @@ async def _step1_password_credentials(self) -> str:
214214

215215
access_token = data["access_token"]
216216
logger.info(f"OAuth2 token obtained: {sanitize_token(access_token)}")
217-
return access_token
217+
return cast(str, access_token)
218218

219219
except httpx.TimeoutException as e:
220220
logger.error("Network timeout during authentication")
@@ -255,7 +255,7 @@ async def _step2_session_status(self, access_token: str) -> str:
255255

256256
session_uuid = data[0]["identifier"]
257257
logger.info(f"Session UUID retrieved: {sanitize_token(session_uuid)}")
258-
return session_uuid
258+
return cast(str, session_uuid)
259259

260260
except httpx.TimeoutException as e:
261261
logger.error("Network timeout during session retrieval")

comdirect_client/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from dataclasses import dataclass
44
from datetime import date
55
from decimal import Decimal
6-
from typing import Optional
6+
from typing import Any, Optional
77

88

99
@dataclass
@@ -60,7 +60,7 @@ class Account:
6060
creditLimit: Optional[AmountValue] = None
6161

6262
@classmethod
63-
def from_dict(cls, data: dict) -> "Account":
63+
def from_dict(cls, data: dict[str, Any]) -> "Account":
6464
"""Create Account from API response dict."""
6565
return cls(
6666
accountId=data["accountId"],
@@ -88,7 +88,7 @@ class AccountBalance:
8888
availableCashAmountEUR: AmountValue
8989

9090
@classmethod
91-
def from_dict(cls, data: dict) -> "AccountBalance":
91+
def from_dict(cls, data: dict[str, Any]) -> "AccountBalance":
9292
"""Create AccountBalance from API response dict."""
9393
return cls(
9494
accountId=data["accountId"],
@@ -126,7 +126,7 @@ class Transaction:
126126
directDebitMandateId: Optional[str] = None
127127

128128
@classmethod
129-
def from_dict(cls, data: dict) -> "Transaction":
129+
def from_dict(cls, data: dict[str, Any]) -> "Transaction":
130130
"""Create Transaction from API response dict."""
131131
booking_date = None
132132
if data.get("bookingDate"):

0 commit comments

Comments
 (0)