in amazon_transcribe/structures.py [0:0]
def read(self, size=-1) -> Optional[bytes]: # type: ignore
if len(self._byte_chunks) < 1 and not self.__done:
raise BlockingIOError("read")
elif (self.__done and not self._byte_chunks) or self.closed:
return b""
temp_bytes = self._byte_chunks.pop(0)
remaining_bytes = b""
if size == -1:
return temp_bytes
elif size > 0:
remaining_bytes = temp_bytes[size:]
temp_bytes = temp_bytes[:size]
else:
remaining_bytes = temp_bytes
temp_bytes = b""
if len(remaining_bytes) > 0:
self._byte_chunks.insert(0, remaining_bytes)
return temp_bytes