channelsabc.py 938 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """Abstract base classes for kernel client channels"""
  2. # Copyright (c) Jupyter Development Team.
  3. # Distributed under the terms of the Modified BSD License.
  4. import abc
  5. from ipython_genutils.py3compat import with_metaclass
  6. class ChannelABC(with_metaclass(abc.ABCMeta, object)):
  7. """A base class for all channel ABCs."""
  8. @abc.abstractmethod
  9. def start(self):
  10. pass
  11. @abc.abstractmethod
  12. def stop(self):
  13. pass
  14. @abc.abstractmethod
  15. def is_alive(self):
  16. pass
  17. class HBChannelABC(ChannelABC):
  18. """HBChannel ABC.
  19. The docstrings for this class can be found in the base implementation:
  20. `jupyter_client.channels.HBChannel`
  21. """
  22. @abc.abstractproperty
  23. def time_to_dead(self):
  24. pass
  25. @abc.abstractmethod
  26. def pause(self):
  27. pass
  28. @abc.abstractmethod
  29. def unpause(self):
  30. pass
  31. @abc.abstractmethod
  32. def is_beating(self):
  33. pass