Skip to content

Commit 0f11526

Browse files
author
Andrei Neagu
committed
renamed
1 parent e37972c commit 0f11526

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

packages/aws-library/src/aws_library/s3/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from pydantic import AnyUrl, ByteSize, TypeAdapter
2020
from servicelib.data_streams import DEFAULT_READ_CHUNK_SIZE, StreamData
2121
from servicelib.logging_utils import log_catch, log_context
22-
from servicelib.s3_utils import FileLikeFileStreamReader
22+
from servicelib.s3_utils import FileLikeDataStreamReader
2323
from servicelib.utils import limited_gather
2424
from settings_library.s3 import S3Settings
2525
from types_aiobotocore_s3 import S3Client
@@ -522,7 +522,7 @@ async def upload_object_from_file_stream(
522522
file_stream: DataStream,
523523
) -> None:
524524
"""streams write an object in S3 from an AsyncIterable[bytes]"""
525-
await self._client.upload_fileobj(FileLikeFileStreamReader(file_stream), bucket_name, object_key) # type: ignore[arg-type]
525+
await self._client.upload_fileobj(FileLikeDataStreamReader(file_stream), bucket_name, object_key) # type: ignore[arg-type]
526526

527527
@staticmethod
528528
def is_multipart(file_size: ByteSize) -> bool:

packages/service-library/src/servicelib/data_streams/_output.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import aiofiles
44
from models_library.data_streams import DataStream
55

6-
from ..s3_utils import FileLikeFileStreamReader
6+
from ..s3_utils import FileLikeDataStreamReader
77

88

99
class DiskStreamWriter:
@@ -17,7 +17,7 @@ async def write_from_stream(self, stream: DataStream) -> None:
1717
await f.flush()
1818

1919
async def write_from_file_like(
20-
self, file_like_reader: FileLikeFileStreamReader
20+
self, file_like_reader: FileLikeDataStreamReader
2121
) -> None:
2222
async with aiofiles.open(self.destination_path, "wb") as f:
2323
while True:

packages/service-library/src/servicelib/s3_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
from models_library.data_streams import DataStream
22

33

4-
class FileLikeFileStreamReader:
5-
def __init__(self, file_stream: DataStream):
6-
self.file_stream = file_stream
4+
class FileLikeDataStreamReader:
5+
def __init__(self, data_stream: DataStream):
6+
self._data_stream = data_stream
77
self._buffer = bytearray()
88
self._async_iterator = self._get_iterator()
99

1010
async def _get_iterator(self):
11-
async for chunk in self.file_stream:
11+
async for chunk in self._data_stream:
1212
yield chunk
1313

1414
async def read(self, size: int) -> bytes:

packages/service-library/tests/test_data_streams.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
)
2424
from servicelib.file_utils import remove_directory
2525
from servicelib.progress_bar import ProgressBarData
26-
from servicelib.s3_utils import FileLikeFileStreamReader
26+
from servicelib.s3_utils import FileLikeDataStreamReader
2727

2828

2929
def _ensure_dir(path: Path) -> Path:
@@ -121,7 +121,7 @@ async def test_get_zip_data_stream(
121121
)
122122

123123
if use_file_like:
124-
await writer.write_from_file_like(FileLikeFileStreamReader(file_stream))
124+
await writer.write_from_file_like(FileLikeDataStreamReader(file_stream))
125125
else:
126126
await writer.write_from_stream(file_stream)
127127

0 commit comments

Comments
 (0)