potiuk commented on a change in pull request #20482:
URL: https://github.com/apache/airflow/pull/20482#discussion_r774515035



##########
File path: airflow/utils/timezone.py
##########
@@ -133,10 +138,10 @@ def make_aware(value: Optional[dt.datetime], timezone: 
Optional["Timezone"] = No
         value = value.replace(fold=1)
     if hasattr(timezone, 'localize'):
         # This method is available for pytz time zones.
-        return timezone.localize(value)
+        return cast(Any, timezone).localize(value)

Review comment:
       There is a discussion about MyPy supporting this case here: 
https://github.com/python/mypy/issues/1424
   
   One of the nice solutions suggested in the thred as a workaround would 
translate to:
   
   ```
   localize = getattr(timezone, 'localize', None)
   if localize is not None:
       return localize(value)
   ```




-- 
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