U '�7`6 � @ s� d Z ddlZddlZddlmZmZmZmZmZ ddl m Z ddlmZm Z dZG dd � d �ZG d d� d�Ze e�G dd � d e��Ze e�G dd� de��ZdS )al Payload implemenation for coroutines as data provider. As a simple case, you can upload data from file:: @aiohttp.streamer async def file_sender(writer, file_name=None): with open(file_name, 'rb') as f: chunk = f.read(2**16) while chunk: await writer.write(chunk) chunk = f.read(2**16) Then you can use `file_sender` like this: async with session.post('http://httpbin.org/post', data=file_sender(file_name='huge_file')) as resp: print(await resp.text()) ..note:: Coroutine must accept `writer` as first argument � N)�Any� Awaitable�Callable�Dict�Tuple� )�AbstractStreamWriter)�Payload�payload_type)�streamerc @ sL e Zd Zeded f eedf eeef dd�dd�Z e dd�dd�ZdS ) �_stream_wrapper.N)�coro�args�kwargs�returnc C s t �|�| _|| _|| _d S �N)�types� coroutiner r r )�selfr r r � r �K/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/payload_streamer.py�__init__# s z_stream_wrapper.__init__��writerr c � s | j |f| j�| j�I d H d S r )r r r �r r r r r �__call__- s z_stream_wrapper.__call__)�__name__� __module__�__qualname__r r r r r �strr r r r r r r r "