base.py 578 B

12345678910111213141516171819
  1. from abc import ABCMeta, abstractmethod
  2. import six
  3. class BaseTrigger(six.with_metaclass(ABCMeta)):
  4. """Abstract base class that defines the interface that every trigger must implement."""
  5. __slots__ = ()
  6. @abstractmethod
  7. def get_next_fire_time(self, previous_fire_time, now):
  8. """
  9. Returns the next datetime to fire on, If no such datetime can be calculated, returns
  10. ``None``.
  11. :param datetime.datetime previous_fire_time: the previous time the trigger was fired
  12. :param datetime.datetime now: current datetime
  13. """