fb53edbc04
To return `None` instead of `int. `Writer.write` *does* write all data in all use case.
35 lines
502 B
Python
35 lines
502 B
Python
from abc import ABC, abstractmethod
|
|
|
|
|
|
class Closer(ABC):
|
|
async def close(self) -> None:
|
|
...
|
|
|
|
|
|
class Reader(ABC):
|
|
@abstractmethod
|
|
async def read(self, n: int = None) -> bytes:
|
|
...
|
|
|
|
|
|
class Writer(ABC):
|
|
@abstractmethod
|
|
async def write(self, data: bytes) -> None:
|
|
...
|
|
|
|
|
|
class WriteCloser(Writer, Closer):
|
|
pass
|
|
|
|
|
|
class ReadCloser(Reader, Closer):
|
|
pass
|
|
|
|
|
|
class ReadWriter(Reader, Writer):
|
|
pass
|
|
|
|
|
|
class ReadWriteCloser(Reader, Writer, Closer):
|
|
pass
|