Merge branch 'dev' into renovate/tox-4.x
All checks were successful
Tests / test (3.10) (pull_request) Successful in 49s
Tests / test (3.11) (pull_request) Successful in 48s
Tests / test (3.12) (pull_request) Successful in 57s
Tests / test (3.8) (pull_request) Successful in 46s
Tests / test (3.9) (pull_request) Successful in 52s

This commit is contained in:
Profitroll 2024-09-19 23:10:05 +03:00
commit e3a8e385b9
11 changed files with 24 additions and 22 deletions

View File

@ -150,7 +150,7 @@ class Client:
boardType=board_type.code,
)
find_exception(board_raw)
find_exception(board_raw.copy())
return BoardArrival(
board_raw,
@ -219,7 +219,7 @@ class Client:
boardType=board_type.code,
)
find_exception(board_raw)
find_exception(board_raw.copy())
return BoardDeparture(
board_raw,
@ -343,7 +343,7 @@ class Client:
minprio=priority_min,
)
find_exception(messages_raw)
find_exception(messages_raw.copy())
if "Message" in messages_raw:
messages.extend(Message(message) for message in messages_raw["Message"])
@ -402,7 +402,7 @@ class Client:
toIdx=to_index,
)
find_exception(journey_raw)
find_exception(journey_raw.copy())
return Journey(journey_raw)
@ -481,7 +481,7 @@ class Client:
locationSelectionMode=selection_mode, # type: ignore
)
find_exception(stops_raw)
find_exception(stops_raw.copy())
if "stopLocationOrCoordLocation" in stops_raw:
for stop in stops_raw["stopLocationOrCoordLocation"]:
@ -536,7 +536,7 @@ class Client:
accessId=self.access_id, inputString=query, lang=lang.code, maxNo=1
)
find_exception(stops_raw)
find_exception(stops_raw.copy())
if len(stops_raw["stopLocationOrCoordLocation"]) <= 0:
return None
@ -642,7 +642,7 @@ class Client:
filterMode=filter_mode.code,
)
find_exception(stops_raw)
find_exception(stops_raw.copy())
if "stopLocationOrCoordLocation" in stops_raw:
for stop in stops_raw["stopLocationOrCoordLocation"]:
@ -833,7 +833,7 @@ class Client:
withFreq=frequency,
)
find_exception(trips_raw)
find_exception(trips_raw.copy())
if "Trip" in trips_raw:
trips.extend(Trip(trip) for trip in trips_raw["Trip"])
@ -913,7 +913,7 @@ class Client:
trafficMessages=messages,
)
find_exception(trips_raw)
find_exception(trips_raw.copy())
if "Trip" in trips_raw:
trips.extend(Trip(trip) for trip in trips_raw["Trip"])

View File

@ -59,9 +59,9 @@ class Message:
self.channels.extend(Channel(channel) for channel in data["channel"])
self.id: str = data["id"]
self.active: bool = data["act"]
self.head: str = data["head"]
self.lead: str = data["lead"]
self.text: str = data["text"]
self.head: str = "" if "head" not in data else data["head"]
self.lead: str = "" if "lead" not in data else data["lead"]
self.text: str = "" if "text" not in data else data["text"]
self.company: Union[str, None] = data.get("company")
self.category: Union[str, None] = data.get("category")
self.priority: Union[int, None] = data.get("priority")

View File

@ -19,8 +19,10 @@ class Trip:
self.index: int = data["idx"]
self.id: str = data["tripId"]
self.ctx_recon: str = data["ctxRecon"]
self.duration: Union[Duration, timedelta] = parse_duration(data["duration"])
self.real_time_duration: Union[Duration, timedelta] = (
self.duration: Union[Duration, timedelta, None] = (
None if "duration" not in data else parse_duration(data["duration"])
)
self.real_time_duration: Union[Duration, timedelta, None] = (
None if "rtDuration" not in data else parse_duration(data["rtDuration"])
)
self.checksum: str = data["checksum"]

View File

@ -64,7 +64,7 @@ def board_arrival(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "date":
if val != None:
if isinstance(val, datetime):

View File

@ -65,7 +65,7 @@ def board_departure(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "date":
if val != None:
if isinstance(val, datetime):

View File

@ -97,7 +97,7 @@ def him_search(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) in {"dateB", "dateE"}:
if val != None:
if isinstance(val, datetime):

View File

@ -55,7 +55,7 @@ def journey_detail(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "rtMode":
if val != None:
payload["rtMode"] = val.upper()

View File

@ -54,7 +54,7 @@ def stop_by_coords(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "stopType":
if val != None:
payload["type"] = val.upper()

View File

@ -65,7 +65,7 @@ def stop_by_name(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "inputString":
if val != None:
payload["input"] = val

View File

@ -201,7 +201,7 @@ def trip_find(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "date":
if val != None:
if isinstance(val, datetime):

View File

@ -87,7 +87,7 @@ def trip_recon(
payload = {}
headers = {"Accept": "application/json"} if json else {"Accept": "application/xml"}
for var, val in locals().items():
for var, val in locals().copy().items():
if str(var) == "date":
if val != None:
if isinstance(val, datetime):