class_docstr: Sensor operators are derived from this class and inherit these attributes.
  
  Sensor operators keep executing at a time interval and succeed when
  a criteria is met and fail if and when they time out.
  
  :param soft_fail: Set to true to mark the task as SKIPPED on failure
  :param poke_interval: Time that the job should wait in between each try.
      Can be ``timedelta`` or ``float`` seconds.
  :param timeout: Time elapsed before the task times out and fails.
      Can be ``timedelta`` or ``float`` seconds.
      This should not be confused with ``execution_timeout`` of the
      ``BaseOperator`` class. ``timeout`` measures the time elapsed between the
      first poke and the current time (taking into account any
      reschedule delay between each poke), while ``execution_timeout``
      checks the **running** time of the task (leaving out any reschedule
      delay). In case that the ``mode`` is ``poke`` (see below), both of
      them are equivalent (as the sensor is never rescheduled), which is not
      the case in ``reschedule`` mode.
  :param mode: How the sensor operates.
      Options are: ``{ poke | reschedule }``, default is ``poke``.
      When set to ``poke`` the sensor is taking up a worker slot for its
      whole execution time and sleeps between pokes. Use this mode if the
      expected runtime of the sensor is short or if a short poke interval
      is required. Note that the sensor will hold onto a worker slot and
      a pool slot for the duration of the sensor's runtime in this mode.
      When set to ``reschedule`` the sensor task frees the worker slot when
      the criteria is not yet met and it's rescheduled at a later time. Use
      this mode if the time before the criteria is met is expected to be
      quite long. The poke interval should be more than one minute to
      prevent too much load on the scheduler.
  :param exponential_backoff: allow progressive longer waits between
      pokes by using exponential backoff algorithm
  :param max_wait: maximum wait interval between pokes, can be ``timedelta`` or ``float`` seconds
  :param silent_fail: If true, and poke method raises an exception different from
      AirflowSensorTimeout, AirflowTaskTimeout, AirflowSkipException
      and AirflowFailException, the sensor will log the error and continue
      its execution. Otherwise, the sensor task fails, and it can be retried
      based on the provided `retries` parameter.
class_docstr_tok: ["Sensor","operators","are","derived","from","this","class","and","inherit","these","attributes",".","Sensor","operators","keep","executing","at","a","time","interval","and","succeed","when","a","criteria","is","met","and","fail","if","and","when","they","time","out",".",":","param","soft_fail",":","Set","to","true","to","mark","the","task","as","SKIPPED","on","failure",":","param","poke_interval",":","Time","that","the","job","should","wait","in","between","each","try",".","Can","be","``","timedelta","``","or","``","float","``","seconds",".",":","param","timeout",":","Time","elapsed","before","the","task","times","out","and","fails",".","Can","be","``","timedelta","``","or","``","float","``","seconds",".","This","should","not","be","confused","with","``","execution_timeout","``","of","the","``","BaseOperator","``","class",".","``","timeout","``","measures","the","time","elapsed","between","the","first","poke","and","the","current","time","(","taking","into","account","any","reschedule","delay","between","each","poke",")",",","while","``","execution_timeout","``","checks","the","*","*","running","*","*","time","of","the","task","(","leaving","out","any","reschedule","delay",")",".","In","case","that","the","``","mode","``","is","``","poke","``","(","see","below",")",",","both","of","them","are","equivalent","(","as","the","sensor","is","never","rescheduled",")",",","which","is","not","the","case","in","``","reschedule","``","mode",".",":","param","mode",":","How","the","sensor","operates",".","Options","are",":","``","{","poke","|","reschedule","}","``",",","default","is","``","poke","``",".","When","set","to","``","poke","``","the","sensor","is","taking","up","a","worker","slot","for","its","whole","execution","time","and","sleeps","between","pokes",".","Use","this","mode","if","the","expected","runtime","of","the","sensor","is","short","or","if","a","short","poke","interval","is","required",".","Note","that","the","sensor","will","hold","onto","a","worker","slot","and","a","pool","slot","for","the","duration","of","the","sensor","'s","runtime","in","this","mode",".","When","set","to","``","reschedule","``","the","sensor","task","frees","the","worker","slot","when","the","criteria","is","not","yet","met","and","it","'s","rescheduled","at","a","later","time",".","Use","this","mode","if","the","time","before","the","criteria","is","met","is","expected","to","be","quite","long",".","The","poke","interval","should","be","more","than","one","minute","to","prevent","too","much","load","on","the","scheduler",".",":","param","exponential_backoff",":","allow","progressive","longer","waits","between","pokes","by","using","exponential","backoff","algorithm",":","param","max_wait",":","maximum","wait","interval","between","pokes",",","can","be","``","timedelta","``","or","``","float","``","seconds",":","param","silent_fail",":","If","true",",","and","poke","method","raises","an","exception","different","from","AirflowSensorTimeout",",","AirflowTaskTimeout",",","AirflowSkipException","and","AirflowFailException",",","the","sensor","will","log","the","error","and","continue","its","execution",".","Otherwise",",","the","sensor","task","fails",",","and","it","can","be","retried","based","on","the","provided","`","retries","`","parameter","."]
code: def _coerce_poke_interval(
      poke_interval: float | timedelta,
  ) -> timedelta:
      if isinstance(poke_interval, timedelta):
          return poke_interval
      if isinstance(poke_interval, (int, float)) and poke_interval >= 0:
          return timedelta(seconds=poke_interval)
      raise AirflowException(
          "Operator arg `poke_interval` must be timedelta object or a non-negative number"
      )
  
imports: from __future__ import annotations
  import datetime
  import functools
  import hashlib
  import logging
  import time
  import traceback
  from datetime import timedelta
  from typing import TYPE_CHECKING, Any, Callable, Iterable
  from airflow import settings
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException, AirflowFailException, AirflowRescheduleException, AirflowSensorTimeout, AirflowSkipException, AirflowTaskTimeout, TaskDeferralError
  from airflow.executors.executor_loader import ExecutorLoader
  from airflow.models.baseoperator import BaseOperator
  from airflow.models.skipmixin import SkipMixin
  from airflow.models.taskreschedule import TaskReschedule
  from airflow.ti_deps.deps.ready_to_reschedule import ReadyToRescheduleDep
  from airflow.utils import timezone
  from airflow.utils.decorators import apply_defaults
  from airflow.utils.session import create_session
label_desc: Use image node_id 2 for calling the BaseSensorOperator obj's underlying member method code with example usage: obj._coerce_poke_interval(poke_interval) and returns: poke_interval, timedelta