Change default value of read()

From `n = -1` to `n = None`, to comply with trio API
This commit is contained in:
mhchia
2020-01-26 23:03:38 +08:00
parent 6e01a7da31
commit 5b4b65faa8
9 changed files with 18 additions and 29 deletions

View File

@ -84,11 +84,8 @@ class DaemonStream(ReadWriteCloser):
async def close(self) -> None:
await self.stream.close()
async def read(self, n: int = -1) -> bytes:
if n == -1:
return await self.stream.receive_some()
else:
return await self.stream.receive_some(n)
async def read(self, n: int = None) -> bytes:
return await self.stream.receive_some(n)
async def write(self, data: bytes) -> None:
return await self.stream.send_all(data)