File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/service-library/src/servicelib Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 11import asyncio
22import hashlib
33import shutil
4+ from collections .abc import Iterator
45from contextlib import contextmanager
56from logging import Logger
67from pathlib import Path
7- from typing import Final , Iterator , Protocol
8+ from typing import Final , Protocol
89
910# https://docs.python.org/3/library/shutil.html#shutil.rmtree
1011# https://docs.python.org/3/library/os.html#os.remove
1314from pydantic import ByteSize , TypeAdapter
1415
1516CHUNK_4KB : Final [ByteSize ] = TypeAdapter (ByteSize ).validate_python ("4kb" ) # 4K blocks
17+ CHUNK_8MB : Final [ByteSize ] = TypeAdapter (ByteSize ).validate_python (
18+ "8MiB"
19+ ) # 8mIB blocks
1620
1721
1822class AsyncStream (Protocol ):
19- async def read (self , size : int = - 1 ) -> bytes :
20- ...
23+ async def read (self , size : int = - 1 ) -> bytes : ...
2124
2225
2326_shutil_rmtree = sync_to_async (shutil .rmtree )
@@ -45,7 +48,7 @@ async def remove_directory(
4548
4649
4750async def create_sha256_checksum (
48- async_stream : AsyncStream , * , chunk_size : ByteSize = CHUNK_4KB
51+ async_stream : AsyncStream , * , chunk_size : ByteSize = CHUNK_8MB
4952) -> str :
5053 """
5154 Usage:
You can’t perform that action at this time.
0 commit comments