19 lines
297 B
Python
19 lines
297 B
Python
from abc import ABC, abstractmethod
|
|
|
|
|
|
class Context(ABC):
|
|
|
|
@abstractmethod
|
|
def stop(self):
|
|
raise NotImplementedError
|
|
|
|
def __enter__(self):
|
|
return self
|
|
|
|
def __exit__(self, exc_type, exc_value, exc_traceback):
|
|
self.stop()
|
|
return (exc_type is None)
|
|
|
|
|
|
|