Dev-iL commented on code in PR #58025:
URL: https://github.com/apache/airflow/pull/58025#discussion_r2517768460
##########
airflow-core/src/airflow/models/dagrun.py:
##########
@@ -351,7 +352,7 @@ def __init__(
if queued_at is NOTSET:
self.queued_at = timezone.utcnow() if state == DagRunState.QUEUED
else None
elif queued_at is not None:
- self.queued_at = queued_at
+ self.queued_at = cast("datetime", queued_at)
Review Comment:
I'm thinking how to avoid this `cast`. Perhaps
```python
if queued_at is NOTSET:
self.queued_at = timezone.utcnow() if state ==
DagRunState.QUEUED else None
elif isinstance(queued_at, datetime): # Assuming the None case is
covered by NOTSET, otherwise:
# elif isinstance(queued_at, datetime) or queued_at is None:
self.queued_at = queued_at
else:
raise TypeError
```
--
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]