Lee-W commented on code in PR #50744:
URL: https://github.com/apache/airflow/pull/50744#discussion_r2095249722
##########
providers/standard/src/airflow/providers/standard/sensors/date_time.py:
##########
@@ -99,6 +99,14 @@ def poke(self, context: Context) -> bool:
self.log.info("Checking if the time (%s) has come", self.target_time)
return timezone.utcnow() > timezone.parse(self.target_time)
+ def _moment(self) -> datetime.datetime:
+ import pendulum
+
+ if isinstance(self.target_time, (pendulum.DateTime,
datetime.datetime)):
+ return self.target_time
+
+ return timezone.parse(self.target_time)
Review Comment:
Not related to your change, but the timezone import above looks weird. could
you please help use re-order it 🙂
##########
providers/standard/src/airflow/providers/standard/sensors/date_time.py:
##########
@@ -99,6 +99,14 @@ def poke(self, context: Context) -> bool:
self.log.info("Checking if the time (%s) has come", self.target_time)
return timezone.utcnow() > timezone.parse(self.target_time)
+ def _moment(self) -> datetime.datetime:
Review Comment:
I probably would make it a `property` 🤔
--
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]