Exemple #1
0
async def test_threaded_generator_max_size(loop, timer):
    @aiomisc.threaded_iterable(max_size=1)
    def arange(*args):
        return (yield from range(*args))

    arange2 = aiomisc.threaded_iterable(max_size=1)(range)

    count = 10

    result = []
    agen = arange(count)
    async for item in agen:
        result.append(item)

    assert result == list(range(count))

    result = []
    agen = arange2(count)
    async for item in agen:
        result.append(item)

    assert result == list(range(count))
Exemple #2
0
from aiohttp_s3_client.xml import (
    create_complete_upload_request,
    parse_create_multipart_upload_id,
)

log = logging.getLogger(__name__)

CHUNK_SIZE = 2**16
DONE = object()
EMPTY_STR_HASH = hashlib.sha256(b"").hexdigest()
PART_SIZE = 5 * 1024 * 1024  # 5MB

HeadersType = t.Union[t.Dict, CIMultiDict, CIMultiDictProxy]

threaded_iterable_constrained = threaded_iterable(max_size=2)


class AwsError(ClientError):
    pass


class AwsUploadError(AwsError):
    pass


class AwsDownloadError(AwsError):
    pass


@threaded