Skip to content

Commit

Permalink
More typing in TimeSensor and TimeSensorAsync (#39696)
Browse files Browse the repository at this point in the history
  • Loading branch information
jedcunningham committed May 20, 2024
1 parent 4d525aa commit f509b0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions airflow/sensors/time_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class TimeSensor(BaseSensorOperator):
"""

def __init__(self, *, target_time, **kwargs):
def __init__(self, *, target_time: datetime.time, **kwargs) -> None:
super().__init__(**kwargs)
self.target_time = target_time

def poke(self, context: Context):
def poke(self, context: Context) -> bool:
self.log.info("Checking if the time (%s) has come", self.target_time)
return timezone.make_naive(timezone.utcnow(), self.dag.timezone).time() > self.target_time

Expand All @@ -62,7 +62,7 @@ class TimeSensorAsync(BaseSensorOperator):
:ref:`howto/operator:TimeSensorAsync`
"""

def __init__(self, *, target_time, **kwargs):
def __init__(self, *, target_time: datetime.time, **kwargs) -> None:
super().__init__(**kwargs)
self.target_time = target_time

Expand All @@ -79,6 +79,6 @@ def execute(self, context: Context):
method_name="execute_complete",
)

def execute_complete(self, context, event=None):
def execute_complete(self, context, event=None) -> None:
"""Execute when the trigger fires - returns immediately."""
return None

0 comments on commit f509b0a

Please sign in to comment.