_streambase.py 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # mypy: allow-untyped-defs
  2. from abc import ABC, abstractmethod
  3. class _StreamBase(ABC):
  4. r"""Base stream class abstraction for multi backends Stream to herit from"""
  5. @abstractmethod
  6. def wait_event(self, event) -> None:
  7. raise NotImplementedError
  8. @abstractmethod
  9. def wait_stream(self, stream) -> None:
  10. raise NotImplementedError
  11. @abstractmethod
  12. def record_event(self, event=None) -> None:
  13. raise NotImplementedError
  14. @abstractmethod
  15. def query(self) -> bool:
  16. raise NotImplementedError
  17. @abstractmethod
  18. def synchronize(self) -> None:
  19. raise NotImplementedError
  20. @abstractmethod
  21. def __eq__(self, stream) -> bool:
  22. raise NotImplementedError
  23. class _EventBase(ABC):
  24. r"""Base Event class abstraction for multi backends Event to herit from"""
  25. @abstractmethod
  26. def wait(self, stream=None) -> None:
  27. raise NotImplementedError
  28. @abstractmethod
  29. def query(self) -> bool:
  30. raise NotImplementedError
  31. @abstractmethod
  32. def synchronize(self) -> None:
  33. raise NotImplementedError