clientabc.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. """Abstract base class for kernel clients"""
  2. #-----------------------------------------------------------------------------
  3. # Copyright (c) The Jupyter Development Team
  4. #
  5. # Distributed under the terms of the BSD License. The full license is in
  6. # the file COPYING, distributed as part of this software.
  7. #-----------------------------------------------------------------------------
  8. #-----------------------------------------------------------------------------
  9. # Imports
  10. #-----------------------------------------------------------------------------
  11. import abc
  12. from ipython_genutils.py3compat import with_metaclass
  13. #-----------------------------------------------------------------------------
  14. # Main kernel client class
  15. #-----------------------------------------------------------------------------
  16. class KernelClientABC(with_metaclass(abc.ABCMeta, object)):
  17. """KernelManager ABC.
  18. The docstrings for this class can be found in the base implementation:
  19. `jupyter_client.client.KernelClient`
  20. """
  21. @abc.abstractproperty
  22. def kernel(self):
  23. pass
  24. @abc.abstractproperty
  25. def shell_channel_class(self):
  26. pass
  27. @abc.abstractproperty
  28. def iopub_channel_class(self):
  29. pass
  30. @abc.abstractproperty
  31. def hb_channel_class(self):
  32. pass
  33. @abc.abstractproperty
  34. def stdin_channel_class(self):
  35. pass
  36. #--------------------------------------------------------------------------
  37. # Channel management methods
  38. #--------------------------------------------------------------------------
  39. @abc.abstractmethod
  40. def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
  41. pass
  42. @abc.abstractmethod
  43. def stop_channels(self):
  44. pass
  45. @abc.abstractproperty
  46. def channels_running(self):
  47. pass
  48. @abc.abstractproperty
  49. def shell_channel(self):
  50. pass
  51. @abc.abstractproperty
  52. def iopub_channel(self):
  53. pass
  54. @abc.abstractproperty
  55. def stdin_channel(self):
  56. pass
  57. @abc.abstractproperty
  58. def hb_channel(self):
  59. pass