404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.117.104.6: ~ $
3

�ga�@s�ddlmZmZddlmZddlmZmZmZddl	m
Z
mZddlm
Z
ddlmZmZmZdd	lmZd
ZGdd�de�ZGd
d�de�ZGdd�ded�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�ABCMeta�abstractmethod)�chain)�Callable�Iterable�Union�)�
Conversion�
Formatting�)�Environment)�smart_decode�smart_encode�UTF8)�HTTPMessages�
+-----------------------------------------+
| NOTE: binary data not shown in terminal |
+-----------------------------------------+c@seZdZdZdS)�DataSuppressedErrorN)�__name__�
__module__�__qualname__�message�rr�/usr/lib/python3.6/streams.pyrsrc@seZdZdZeZdS)�BinarySuppressedErrorzbAn error indicating that the body is binary and won't be written,
     e.g., for terminal output).N)rrr�__doc__�BINARY_SUPPRESSED_NOTICErrrrrrsrc@sbeZdZdZdeeegdfd�dd�Zed�dd	�Ze	e
ed�d
d��Ze
ed�dd
�ZdS)�
BaseStreamz&Base HTTP message output stream class.TN)�msg�on_body_chunk_downloadedcCs||_||_||_||_dS)z�
        :param msg: a :class:`models.HTTPMessage` subclass
        :param with_headers: if `True`, headers will be included
        :param with_body: if `True`, body will be included

        N)r�with_headers�	with_bodyr)�selfrrrrrrr�__init__ szBaseStream.__init__)�returncCs|jjj�S)zReturn the headers' bytes.)r�headers�encode)r rrr�get_headers3szBaseStream.get_headerscCsdS)z)Return an iterator over the message body.Nr)r rrr�	iter_body7szBaseStream.iter_bodyccs�|jr|j�VdV|jr�y,x&|j�D]}|V|jr(|j|�q(WWn6tk
r~}z|jrfdV|jVWYdd}~XnXdS)z#Return an iterator over `self.msg`.s

�
N)rr%rr&rrr)r �chunk�errr�__iter__;s
zBaseStream.__iter__)TTN)
rrrrrr�bytesr!r%rrr&r*rrrrrsr)�	metaclasscs>eZdZdZd
ZdZef�fdd�	Zeed�dd	�Z	�Z
S)�	RawStreamz5The message is streamed in chunks with no processing.i�drcst�jf|�||_dS)N)�superr!�
chunk_size)r r0�kwargs)�	__class__rrr!SszRawStream.__init__)r"cCs|jj|j�S)N)rr&r0)r rrrr&WszRawStream.iter_bodyi�)rrrr�
CHUNK_SIZEZCHUNK_SIZE_BY_LINEr!rr+r&�
__classcell__rr)r2rr-Ms
r-csHeZdZdZdZe�ddfeed��fdd�
Zee	d�dd	�Z
�ZS)
�
EncodedStreamz�Encoded HTTP message stream.

    The message bytes are converted to an encoding suitable for
    `self.env.stdout`. Unicode errors are replaced and binary data
    is suppressed. The body is always streamed by line.

    rN)�mime_overwrite�encoding_overwritecsNt�jf|�|p|jj|_|p&|jj|_|jr8|j}n|jj}|pFt|_	dS)N)
r/r!rZcontent_type�mime�encodingZ
stdout_isattyZstdout_encodingr�output_encoding)r �envr6r7r1r:)r2rrr!eszEncodedStream.__init__)r"ccsLxF|jj|j�D]4\}}d|kr&t��t||j�}t||j�|VqWdS)N�)r�
iter_linesr3rr
r9rr:)r �line�lfrrrr&xs
zEncodedStream.iter_body)rrrrr3r�strr!rr+r&r4rr)r2rr5[sr5csdeZdZdZdZeed��fdd�Zed�dd�Z	e
ed�d	d
�Zee
efed�dd
�Z�ZS)�PrettyStreamz�In addition to :class:`EncodedStream` behaviour, this stream applies
    content processing.

    Useful for long-lived HTTP responses that stream by lines
    such as the Twitter streaming API.

    r)�
conversion�
formattingcst�jf|�||_||_dS)N)r/r!rCrB)r rBrCr1)r2rrr!�szPrettyStream.__init__)r"cCs|jj|jj�j|j�S)N)rCZformat_headersrr#r$r:)r rrrr%�szPrettyStream.get_headersccs�d}|jj|j�}x�|D]�\}}d|kr�|r�|jj|j�}|r�t�}x0t||fg|�D]\}}|j|�|j|�qVW|j	|�\|_}|j
|�VdSt��|j
|�|Vd}qWdS)NTr<F)rr=r3rB�
get_converterr8�	bytearrayr�extend�convert�process_bodyr)r Zfirst_chunkr=r>r?�	converter�bodyrrrr&�s"
zPrettyStream.iter_body)r(r"cCs4t|t�st||j�}|jj||jd�}t||j�S)N)Zcontentr8)	�
isinstancer@r
r9rCZformat_bodyr8rr:)r r(rrrrH�s
zPrettyStream.process_body)rrrrr3r	r
r!r+r%rr&rr@rHr4rr)r2rrA�srAc@s&eZdZdZdZeed�dd�ZdS)	�BufferedPrettyStreamz�The same as :class:`PrettyStream` except that the body is fully
    fetched before it's processed.

    Suitable regular HTTP responses.

    i�
)r"ccsvd}t�}xF|jj|j�D]4}|rDd|krD|jj|j�}|sDt��|j|�qW|rf|j	|�\|_}|j
|�VdS)Nr<)rErr&r3rBrDr8rrFrGrH)r rIrJr(rrrr&�szBufferedPrettyStream.iter_bodyNi()rrrrr3rr+r&rrrrrL�srLN)�abcrr�	itertoolsrZtypingrrrZ
processingr	r
�contextrr9r
rrZmodelsrr�	Exceptionrrrr-r5rArLrrrr�<module>s0%6

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 113 B 0644
__init__.cpython-36.pyc File 113 B 0644
processing.cpython-36.opt-1.pyc File 2.06 KB 0644
processing.cpython-36.pyc File 2.06 KB 0644
streams.cpython-36.opt-1.pyc File 6.38 KB 0644
streams.cpython-36.pyc File 6.44 KB 0644
utils.cpython-36.opt-1.pyc File 1.06 KB 0644
utils.cpython-36.pyc File 1.06 KB 0644
writer.cpython-36.opt-1.pyc File 3.31 KB 0644
writer.cpython-36.pyc File 3.31 KB 0644