From 894e4a3fe0f760046415f04eaf1ac99f68030a68 Mon Sep 17 00:00:00 2001 From: Joscha Schmiedt <joscha@schmiedt.dev> Date: Wed, 17 Apr 2024 23:30:49 +0200 Subject: [PATCH] Fix type hints for TimeZone.offset The docstring and type hint indicated `int` bit it's actually a str. --- src/linkahead/common/models.py | 3 +-- src/linkahead/common/timezone.py | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py index 192b2cb5..f6447cde 100644 --- a/src/linkahead/common/models.py +++ b/src/linkahead/common/models.py @@ -5128,10 +5128,9 @@ def _parse_single_xml_element(elem: etree._Element): elif elem.tag == "UserInfo": return UserInfo(xml=elem) elif elem.tag == "TimeZone": - offset = elem.get("offset") return TimeZone( zone_id=elem.get("id"), - offset=int(offset) if offset is not None else None, + offset=elem.get("offset"), display_name=elem.text.strip() if elem.text is not None else "", ) else: diff --git a/src/linkahead/common/timezone.py b/src/linkahead/common/timezone.py index 293deaf4..9ccb433c 100644 --- a/src/linkahead/common/timezone.py +++ b/src/linkahead/common/timezone.py @@ -11,13 +11,13 @@ class TimeZone(): ---------- zone_id : string ID of the time zone. - offset : int - Offset to UTC in seconds. + offset : str + Offset to UTC, e.g. "+1400" display_name : string A human-friendly name of the time zone: """ - def __init__(self, zone_id: Optional[str], offset: Optional[int], display_name: str): + def __init__(self, zone_id: Optional[str], offset: Optional[str], display_name: str): self.zone_id = zone_id self.offset = offset self.display_name = display_name -- GitLab