Update StreamResponse.write annotation for strict-bytes (#10154) · aio-libs/aiohttp@3f07b1a (original) (raw)

Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ def enable_compression(
72 72 ) -> None:
73 73 self._compress = ZLibCompressor(encoding=encoding, strategy=strategy)
74 74
75 -def _write(self, chunk: bytes) -> None:
75 +def _write(self, chunk: Union[bytes, bytearray, memoryview]) -> None:
76 76 size = len(chunk)
77 77 self.buffer_size += size
78 78 self.output_size += size
@@ -93,7 +93,11 @@ def _writelines(self, chunks: Iterable[bytes]) -> None:
93 93 transport.write(b"".join(chunks))
94 94
95 95 async def write(
96 -self, chunk: bytes, *, drain: bool = True, LIMIT: int = 0x10000
96 +self,
97 +chunk: Union[bytes, bytearray, memoryview],
98 +*,
99 +drain: bool = True,
100 +LIMIT: int = 0x10000,
97 101 ) -> None:
98 102 """Writes chunk of data to a stream.
99 103