Source code for hupper.interfaces
import abc
from .compat import with_metaclass
[docs]
class IReloaderProxy(with_metaclass(abc.ABCMeta)):
[docs]
@abc.abstractmethod
def watch_files(self, files):
""" Signal to the monitor to track some custom paths."""
[docs]
@abc.abstractmethod
def trigger_reload(self):
""" Signal the monitor to execute a reload."""
[docs]
class IFileMonitorFactory(with_metaclass(abc.ABCMeta)):
[docs]
def __call__(self, callback):
""" Return an :class:`.IFileMonitor` instance.
``callback`` is a callable to be invoked by the ``IFileMonitor``
when file changes are detected. It should accept the path of
the changed file as its only parameter.
"""
[docs]
class IFileMonitor(with_metaclass(abc.ABCMeta)):
[docs]
@abc.abstractmethod
def add_path(self, path):
""" Start monitoring a new path."""
[docs]
@abc.abstractmethod
def start(self):
""" Start the monitor. This method should not block."""
[docs]
@abc.abstractmethod
def stop(self):
""" Trigger the monitor to stop.
This should be called before invoking :meth:`.join`.
"""
[docs]
@abc.abstractmethod
def join(self):
""" Block until the monitor has stopped."""