uranusjr commented on a change in pull request #20000:
URL: https://github.com/apache/airflow/pull/20000#discussion_r762159303



##########
File path: airflow/utils/timezone.py
##########
@@ -175,6 +175,16 @@ def parse(string: str, timezone=None) -> DateTime:
     return pendulum.parse(string, tz=timezone or TIMEZONE, strict=False)  # 
type: ignore
 
 
+@overload
+def coerce_datetime(v: None) -> None:
+    ...
+
+
+@overload
+def coerce_datetime(v: Union[dt.datetime, DateTime]) -> DateTime:
+    ...

Review comment:
       `pendulum.DateTime` is a stdlib `datetime` subclass, so this is 
equivalent to
   
   ```suggestion
   def coerce_datetime(v: dt.datetime) -> DateTime:
       ...
   ```
   
   same goes for the original annotation; it can just be 
`Optional[dt.datetime]`.




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