def _read_from_s3()

in iopath/common/s3.py [0:0]


    def _read_from_s3(self, download_range: range) -> bytes:
        obj = self.client.get_object(
            Bucket=self.bucket,
            Key=self.key,
            Range=f"bytes={download_range.start}-{download_range.stop}",
        )
        streaming_body = obj["Body"]

        if self.timeout is not None:
            streaming_body.set_socket_timeout(self.timeout)

        ret = bytearray()
        for chunk in streaming_body.iter_chunks(chunk_size=self.chunk_size):
            ret += chunk
        streaming_body.close()
        return ret