ok

Mini Shell

Direktori : /opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/site-packages/aiohttp/__pycache__/payload.cpython-38.pyc

U

'�7`4�@s�ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlm
Z
mZmZmZmZmZmZmZmZmZmZmZddlmZddlmZddlmZdd	lmZm Z m!Z!m"Z"m#Z#dd
l$m%Z%ddl&m'Z'm(Z(dZ)d
Z*e�rddlm+Z+Gdd�de,�Z-Gdd�de.ej/�Z0eeedd�dd�Z1e0j2d�edee0dd�dd�Z3Gdd�d�Z4Gdd�d�Z5Gdd�de�Z6Gd d!�d!e6�Z7Gd"d#�d#e7�Z8Gd$d%�d%e8�Z9Gd&d'�d'e6�Z:Gd(d)�d)e:�Z;Gd*d+�d+e:�Z<Gd,d-�d-e:�Z=Gd.d/�d/e7�Z>e�r.dd0lm?Z?m@Z@e@eAZBe?eAZCndd0lDm?Z?m@Z@e@ZBe?ZCGd1d2�d2e6�ZEGd3d4�d4eE�ZFe5�ZGeG�He7eAeIeJf�eG�He8e.�eG�He9ejK�eG�He;ejL�eG�He<ejM�eG�He=ejNejOf�eG�He:ejP�eG�HeFe%�eGjHeEe?e0jQd�dS)5�N)�ABC�abstractmethod)�chain)�IO�
TYPE_CHECKING�Any�
ByteString�Dict�Iterable�Optional�Text�TextIO�Tuple�Type�Union)�CIMultiDict�)�hdrs)�AbstractStreamWriter)�PY_36�content_disposition_header�guess_filename�parse_mimetype�sentinel)�StreamReader)�JSONEncoder�_CIMultiDict)
�PAYLOAD_REGISTRY�get_payload�payload_type�Payload�BytesPayload�
StringPayload�
IOBasePayload�BytesIOPayload�BufferedReaderPayload�
TextIOPayload�StringIOPayload�JsonPayload�AsyncIterablePayloadi)�Listc@seZdZdS)�LookupErrorN)�__name__�
__module__�__qualname__�r/r/�B/opt/alt/python38/lib64/python3.8/site-packages/aiohttp/payload.pyr+>sr+c@seZdZdZdZdZdS)�Order�normal�	try_first�try_lastN)r,r-r.r2r3r4r/r/r/r0r1Bsr1r )�data�args�kwargs�returncOstj|f|�|�S�N)r�get)r5r6r7r/r/r0rHsr��order��factory�typer<r8cCstj|||d�dS�Nr;)r�register)r>r?r<r/r/r0�register_payloadLsrBc@s>eZdZejd�eedd�dd�Zededd�dd	�ZdS)
rr;N)r?r<r8cCs||_||_dSr9)r?r<)�selfr?r<r/r/r0�__init__Sszpayload_type.__init__r )r>r8cCst||j|jd�|Sr@)rBr?r<)rCr>r/r/r0�__call__Wszpayload_type.__call__)	r,r-r.r1r2rrDrrEr/r/r/r0rRsrc@sZeZdZdZdd�dd�Zed�eeeedd�d	d
�Zej	d�e
deedd�d
d�ZdS)�PayloadRegistryzZPayload registry.

    note: we need zope.interface for more efficient adapter search
    N�r8cCsg|_g|_g|_dSr9)�_first�_normal�_last�rCr/r/r0rDbszPayloadRegistry.__init__)�_CHAINr )r5r6rLr7r8cOsRt|t�r|S||j|j|j�D]&\}}t||�r ||f|�|�Sq t��dSr9)�
isinstancer rHrIrJr+)rCr5rLr6r7r>r?r/r/r0r:gs

zPayloadRegistry.getr;r=cCsf|tjkr|j�||f�nF|tjkr8|j�||f�n*|tjkrT|j�||f�ntd|����dS)NzUnsupported order )	r1r3rH�appendr2rIr4rJ�
ValueError)rCr>r?r<r/r/r0rArs


zPayloadRegistry.register)r,r-r.�__doc__rDrrr:r1r2rrAr/r/r/r0rF\s"����rFc
@seZdZdZdZdeddfeeee	e
eefee
eeffeeeeeeedd�dd�Zeeed�dd��Zeeed�d	d
��Zee	d�dd��Zeed�d
d��Zeeed�dd��Zeed�dd��Zdeeedd�dd�Zeedd�dd��ZdS)r �application/octet-streamN)�value�headers�content_type�filename�encodingr7r8cKs�||_||_t�|_||_|tk	r8|dk	r8||jtj<nD|jdk	rnt�	|j�d}|dkr`|j
}||jtj<n|j
|jtj<|j�|p�i�dS�Nr)�	_encoding�	_filenamer�_headers�_valuerr�CONTENT_TYPE�	mimetypesZ
guess_type�_default_content_type�update)rCrRrSrTrUrVr7r/r/r0rD�s
zPayload.__init__rGcCs|jS)zSize of the payload.)�_sizerKr/r/r0�size�szPayload.sizecCs|jS)zFilename of the payload.)rYrKr/r/r0rU�szPayload.filenamecCs|jS)zCustom item headers)rZrKr/r/r0rS�szPayload.headerscCs$d�dd�|j��D���d�dS)N�cSs g|]\}}|d|d�qS)z: z
r/)�.0�k�vr/r/r0�
<listcomp>�sz+Payload._binary_headers.<locals>.<listcomp>�utf-8s
)�joinrS�items�encoderKr/r/r0�_binary_headers�s���zPayload._binary_headerscCs|jS)zPayload encoding)rXrKr/r/r0rV�szPayload.encodingcCs|jtjS)zContent type)rZrr\rKr/r/r0rT�szPayload.content_typeT)�disptype�quote_fields�paramsr8cKs t|fd|i|��|jtj<dS)z$Sets ``Content-Disposition`` header.rmN)rrZr�CONTENT_DISPOSITION)rCrlrmrnr/r/r0�set_content_disposition�s���zPayload.set_content_disposition��writerr8c�sdS)zLWrite payload.

        writer is an AbstractStreamWriter instance:
        Nr/�rCrrr/r/r0�write�sz
Payload.write)T)r,r-r.r^r`rrrrrr	�strr
rrD�property�intrarUrS�bytesrkrVrT�boolrprrrtr/r/r/r0r sL� ����cs8eZdZeeedd��fdd�Zedd�dd�Z�ZS)r!N�rRr6r7r8cs�t|tttf�s"td�t|����d|kr2d|d<t�j|f|�|�t|t�rZ|j	|_
n
t|�|_
|j
tkr�t
r|d|i}ni}tjdtf|�dS)Nz)value argument must be byte-ish, not {!r}rTrQ�sourcez}Sending a large body directly with raw bytes might lock the event loop. You should probably pass an io.BytesIO object instead)rMrx�	bytearray�
memoryview�	TypeError�formatr?�superrD�nbytesr`�len�TOO_LARGE_BYTES_BODYr�warnings�warn�ResourceWarning�rCrRr6r7��	__class__r/r0rD�s(�




��zBytesPayload.__init__rqc�s|�|j�IdHdSr9)rtr[rsr/r/r0rt�szBytesPayload.write)	r,r-r.rrrDrrt�
__classcell__r/r/r�r0r!�sr!cs<eZdZddd�eeeeeeedd��fdd�Z�ZS)r"N�rVrT�rRr6rVrTr7r8csn|dkr2|dkrd}d}qFt|�}|j�dd�}n|dkrBd|}|}t�j|�|�f|�||d�|��dS)Nrg�text/plain; charset=utf-8�charset�text/plain; charset=%sr�)r�
parametersr:r�rDrj)rCrRrVrTr6r7Z
real_encoding�mimetyper�r/r0rD�s&	����zStringPayload.__init__)	r,r-r.rrrrurDr�r/r/r�r0r"�s��r"cs,eZdZeeeedd��fdd�Z�ZS)r'Nrzcst�j|��f|�|�dSr9)r�rD�readr�r�r/r0rDszStringIOPayload.__init__)r,r-r.rrurrDr�r/r/r�r0r'sr'cs@eZdZd	eeeeedd��fdd�
Zedd�dd�Z�Z	S)
r#�
attachmentN)rR�dispositionr6r7r8csZd|krt|�|d<t�j|f|�|�|jdk	rV|dk	rVtj|jkrV|j||jd�dS)NrU)rU)rr�rDrYrrorSrp)rCrRr�r6r7r�r/r0rDszIOBasePayload.__init__rqc
�spt��}zJ|�d|jjd�IdH}|rP|�|�IdH|�d|jjd�IdH}q"W5|�d|jj�IdHXdS�Ni)�asyncio�get_event_loop�run_in_executorr[�closer�rt�rCrrZloop�chunkr/r/r0rt#szIOBasePayload.write)r�)
r,r-r.rrrurDrrtr�r/r/r�r0r#s��r#csbeZdZddd�eeeeeeedd��fdd�Zeee	d�dd��Z
edd	�d
d�Z�Z
S)r&Nr�r�csd|dkr2|dkrd}d}qBt|�}|j�dd�}n|dkrBd|}t�j|f|�||d�|��dS)Nrgr�r�r��rTrV)rr�r:r�rD)rCrRrVrTr6r7r�r�r/r0rD/s$	����zTextIOPayload.__init__rGcCs:zt�|j���j|j��WStk
r4YdSXdSr9��os�fstatr[�fileno�st_size�tell�OSErrorrKr/r/r0raKszTextIOPayload.sizerqc
�sxt��}zR|�d|jjd�IdH}|rX|�|�|j��IdH|�d|jjd�IdH}q"W5|�d|jj�IdHXdSr�)	r�r�r�r[r�r�rtrjrXr�r/r/r0rtRszTextIOPayload.write)r,r-r.r
rrrurDrvrwrarrtr�r/r/r�r0r&.s��r&c@seZdZeed�dd��ZdS)r$rGcCs.|j��}|j�dtj�}|j�|�||SrW)r[r��seekr��SEEK_END)rCZposition�endr/r/r0ra^s
zBytesIOPayload.sizeN)r,r-r.rvrwrar/r/r/r0r$]sr$c@s"eZdZeeed�dd��ZdS)r%rGcCs:zt�|j���j|j��WStk
r4YdSXdSr9r�rKr/r/r0ragszBufferedReaderPayload.sizeN)r,r-r.rvrrwrar/r/r/r0r%fsr%c	s8eZdZddejfeeeeeedd��fdd�
Z�Z	S)r(rgzapplication/jsonN)rRrVrT�dumpsr6r7r8cs,t�j||��|�f|�||d�|��dS)Nr�)r�rDrj)rCrRrVrTr�r6r7r�r/r0rDrs
����zJsonPayload.__init__)
r,r-r.�jsonr�rrurrDr�r/r/r�r0r(qs��r()�
AsyncIterable�
AsyncIteratorcs<eZdZdZeeedd��fdd�Zedd�dd�Z�Z	S)r)NrzcsNt|t�std�t|����d|kr,d|d<t�j|f|�|�|��|_dS)NzOvalue argument must support collections.abc.AsyncIterablebe interface, got {!r}rTrQ)	rMr�r~rr?r�rD�	__aiter__�_iterr�r�r/r0rD�s
��zAsyncIterablePayload.__init__rqc�sL|jrHz&|j��IdH}|�|�IdHqWntk
rFd|_YnXdSr9)r��	__anext__rt�StopAsyncIteration)rCrrr�r/r/r0rt�szAsyncIterablePayload.write)
r,r-r.r��_AsyncIterablerrDrrtr�r/r/r�r0r)�sr)cs(eZdZeeedd��fdd�Z�ZS)�StreamReaderPayloadNrzcst�j|��f|�|�dSr9)r�rDZiter_anyr�r�r/r0rD�szStreamReaderPayload.__init__)r,r-r.rrrDr�r/r/r�r0r��sr�)Rr��enum�ior�r]r�r��abcrr�	itertoolsr�typingrrrrr	r
rrr
rrrZ	multidictrrbrrZhelpersrrrrrZstreamsrZtypedefsrr�__all__r�r*�	Exceptionr+ru�Enumr1rr2rBrrFr r!r"r'r#r&r$r%r(r�r�rxZ_AsyncIteratorr�Zcollections.abcr)r�rrAr|r}�StringIO�
TextIOBase�BytesIO�BufferedReader�BufferedRandom�IOBaser4r/r/r/r0�<module>sv8��
#Q"/	


Zerion Mini Shell 1.0