bolkedebruin commented on code in PR #34492:
URL: https://github.com/apache/airflow/pull/34492#discussion_r1333372959


##########
airflow/serialization/serializers/datetime.py:
##########
@@ -62,12 +68,30 @@ def deserialize(classname: str, version: int, data: dict | 
str) -> datetime.date
 
     from pendulum import DateTime
     from pendulum.tz import timezone
+    from pytz.reference import USTimeZone

Review Comment:
   I think this can be moved below the version check (i.e. being part of v1 
only). I am wondering if we could do this without importing pytz as we do not 
rely on an explicit import of pytz in Airflow



##########
airflow/serialization/serializers/datetime.py:
##########
@@ -62,12 +68,30 @@ def deserialize(classname: str, version: int, data: dict | 
str) -> datetime.date
 
     from pendulum import DateTime
     from pendulum.tz import timezone
+    from pytz.reference import USTimeZone
+
+    tz: USTimeZone | Timezone | None = None
+    if isinstance(data, dict) and TIMEZONE in data:
+        if version == 1:
+            # try to deserialize unsupported US timezones
+            mapping_us_timezones = {
+                "EDT": USTimeZone(-5, "Eastern", "EST", "EDT"),

Review Comment:
   in pytz these are already defined as Eastern, Central, Mountain and Pacific. 
No need to redefine I guess?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to