1*da0073e9SAndroid Build Coastguard Worker# mypy: allow-untyped-defs 2*da0073e9SAndroid Build Coastguard Workerfrom abc import ABC, abstractmethod 3*da0073e9SAndroid Build Coastguard Worker 4*da0073e9SAndroid Build Coastguard Worker 5*da0073e9SAndroid Build Coastguard Workerclass _StreamBase(ABC): 6*da0073e9SAndroid Build Coastguard Worker r"""Base stream class abstraction for multi backends Stream to herit from""" 7*da0073e9SAndroid Build Coastguard Worker 8*da0073e9SAndroid Build Coastguard Worker @abstractmethod 9*da0073e9SAndroid Build Coastguard Worker def wait_event(self, event) -> None: 10*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 11*da0073e9SAndroid Build Coastguard Worker 12*da0073e9SAndroid Build Coastguard Worker @abstractmethod 13*da0073e9SAndroid Build Coastguard Worker def wait_stream(self, stream) -> None: 14*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 15*da0073e9SAndroid Build Coastguard Worker 16*da0073e9SAndroid Build Coastguard Worker @abstractmethod 17*da0073e9SAndroid Build Coastguard Worker def record_event(self, event=None) -> None: 18*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 19*da0073e9SAndroid Build Coastguard Worker 20*da0073e9SAndroid Build Coastguard Worker @abstractmethod 21*da0073e9SAndroid Build Coastguard Worker def query(self) -> bool: 22*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 23*da0073e9SAndroid Build Coastguard Worker 24*da0073e9SAndroid Build Coastguard Worker @abstractmethod 25*da0073e9SAndroid Build Coastguard Worker def synchronize(self) -> None: 26*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 27*da0073e9SAndroid Build Coastguard Worker 28*da0073e9SAndroid Build Coastguard Worker @abstractmethod 29*da0073e9SAndroid Build Coastguard Worker def __eq__(self, stream) -> bool: 30*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 31*da0073e9SAndroid Build Coastguard Worker 32*da0073e9SAndroid Build Coastguard Worker 33*da0073e9SAndroid Build Coastguard Workerclass _EventBase(ABC): 34*da0073e9SAndroid Build Coastguard Worker r"""Base Event class abstraction for multi backends Event to herit from""" 35*da0073e9SAndroid Build Coastguard Worker 36*da0073e9SAndroid Build Coastguard Worker @abstractmethod 37*da0073e9SAndroid Build Coastguard Worker def wait(self, stream=None) -> None: 38*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 39*da0073e9SAndroid Build Coastguard Worker 40*da0073e9SAndroid Build Coastguard Worker @abstractmethod 41*da0073e9SAndroid Build Coastguard Worker def query(self) -> bool: 42*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 43*da0073e9SAndroid Build Coastguard Worker 44*da0073e9SAndroid Build Coastguard Worker @abstractmethod 45*da0073e9SAndroid Build Coastguard Worker def synchronize(self) -> None: 46*da0073e9SAndroid Build Coastguard Worker raise NotImplementedError 47