uranusjr commented on code in PR #30292:
URL: https://github.com/apache/airflow/pull/30292#discussion_r1148886413


##########
airflow/operators/trigger_dagrun.py:
##########
@@ -40,9 +42,27 @@
 
 
 if TYPE_CHECKING:
+    from sqlalchemy.orm.session import Session
+
     from airflow.models.taskinstance import TaskInstanceKey
 
 
+def _parse_execution_date(date: datetime.datetime | str | None) -> 
datetime.datetime:
+    if isinstance(date, datetime.datetime):
+        return date
+    elif isinstance(date, str):
+        return timezone.parse(date)
+    else:
+        return timezone.utcnow()

Review Comment:
   This else block feels unintuitive from the function name. Either the name 
should be more specific (giving context why defaulting to now is correct), or 
the None case should be handled by the call site instead.



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