先帝创业未半而中道崩殂,今天下三分,益州疲弊,此诚危急存亡之秋也。然侍卫之臣不懈于内,忠志之士忘身于外者,盖追先帝之殊遇,欲报之于陛下也。诚宜开张圣听,以光先帝遗德,恢弘志士之气,不宜妄自菲薄,引喻失义,以塞忠谏之路也先帝は天下を興す志半ばにして志半ばにして崩御されました。今、天下は三つに分かれ、益州は疲弊しており、まさに存亡の危機に瀕しております。しかしながら、宮中で職務に励む臣下や、外地で身を顧みず尽力する志士たちがいるのは、ひとえに先帝から受けた格別な恩義を思い、陛下に報いようとする志があるからです。今こそ陛下には広く臣下の意見に耳を傾け、先帝の遺徳を輝かせ、志士たちの士気を高めるべきです。決して自らを卑下したり、不適切な例えを用いて忠言の道を閉ざしたりしてはなりません。鍏堝笣鍒涗笟鏈崐鑰屼腑閬撳穿娈傦紝浠婂ぉ涓嬩笁鍒嗭紝鐩婂窞鐤插紛锛屾璇氬嵄鎬ュ瓨浜′箣绉嬩篃銆傜劧渚嶅崼涔嬭嚕涓嶆噲浜庡唴锛屽繝蹇椾箣澹繕韬簬澶栬€咃紝鐩栬拷鍏堝笣涔嬫畩閬囷紝娆叉姤涔嬩簬闄涗笅涔熴€傝瘹瀹滃紑寮犲湥鍚紝浠ュ厜鍏堝笣閬楀痉锛屾仮寮樺織澹箣姘旓紝涓嶅疁濡勮嚜鑿茶杽锛屽紩鍠诲け涔夛紝浠ュ蹇犺皬涔嬭矾涔🌌 SpectraShell

🌌 SpectraShell

Current path: usr/lib64/python3.6/asyncio/__pycache__/



⬆️ Go up: /usr/lib64/python3.6/asyncio

📄 Viewing: streams.cpython-36.pyc

3


 \�_�@sLdZdddddddgZdd	lZeed
�r6ejddg�d
dlmZd
dlmZd
dlmZd
dlm	Z	d
dlm
Z
d
dlmZd"Z
Gdd�de�ZGdd�de�Ze
d#d	e
d�dd��Ze
d$d	e
d�dd��Zeed
��re
d%d	e
d�dd��Ze
d&d	e
d�dd��ZGdd�de	j�ZGdd�dee	j�ZGd d�d�ZGd!d�d�Zd	S)'zStream-related things.�StreamReader�StreamWriter�StreamReaderProtocol�open_connection�start_server�IncompleteReadError�LimitOverrunError�NZAF_UNIX�open_unix_connection�start_unix_server�)�
coroutines)�compat)�events)�	protocols)�	coroutine)�logger��cs(eZdZdZ�fdd�Zdd�Z�ZS)rz�
    Incomplete read error. Attributes:

    - partial: read bytes string before the end of stream was reached
    - expected: total number of expected bytes (or None if unknown)
    cs(t�jdt|�|f�||_||_dS)Nz-%d bytes read on a total of %r expected bytes)�super�__init__�len�partial�expected)�selfrr)�	__class__��'/usr/lib64/python3.6/asyncio/streams.pyr szIncompleteReadError.__init__cCst|�|j|jffS)N)�typerr)rrrr�
__reduce__&szIncompleteReadError.__reduce__)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__rr)rrrscs(eZdZdZ�fdd�Zdd�Z�ZS)rz�Reached the buffer limit while looking for a separator.

    Attributes:
    - consumed: total number of to be consumed bytes.
    cst�j|�||_dS)N)rr�consumed)r�messager$)rrrr0szLimitOverrunError.__init__cCst|�|jd|jffS)Nr)r�argsr$)rrrrr4szLimitOverrunError.__reduce__)rr r!r"rrr#rr)rrr*s)�loop�limitc	+sb|dkrtj�}t||d�}t||d��|j�fdd�||f|�EdH\}}t|�||�}||fS)a�A wrapper for create_connection() returning a (reader, writer) pair.

    The reader returned is a StreamReader instance; the writer is a
    StreamWriter instance.

    The arguments are all the usual arguments to create_connection()
    except protocol_factory; most common are positional host and port,
    with various optional keyword arguments following.

    Additional optional keyword arguments are loop (to set the event loop
    instance to use) and limit (to set the buffer limit passed to the
    StreamReader).

    (If you want to customize the StreamReader and/or
    StreamReaderProtocol classes, just copy the code -- there's
    really nothing special here except some convenience.)
    N)r(r')r'cs�S)Nrr)�protocolrr�<lambda>Qsz!open_connection.<locals>.<lambda>)r�get_event_looprrZcreate_connectionr)	�host�portr'r(�kwds�reader�	transport�_�writerr)r)rr8s c+s8�dkrtj�����fdd�}�j|||f|�EdHS)a�Start a socket server, call back for each client connected.

    The first parameter, `client_connected_cb`, takes two parameters:
    client_reader, client_writer.  client_reader is a StreamReader
    object, while client_writer is a StreamWriter object.  This
    parameter can either be a plain callback function or a coroutine;
    if it is a coroutine, it will be automatically converted into a
    Task.

    The rest of the arguments are all the usual arguments to
    loop.create_server() except protocol_factory; most common are
    positional host and port, with various optional keyword arguments
    following.  The return value is the same as loop.create_server().

    Additional optional keyword arguments are loop (to set the event loop
    instance to use) and limit (to set the buffer limit passed to the
    StreamReader).

    The return value is the same as loop.create_server(), i.e. a
    Server object which can be used to stop the service.
    Ncst��d�}t|��d�}|S)N)r(r')r')rr)r/r))�client_connected_cbr(r'rr�factoryqszstart_server.<locals>.factory)rr+Z
create_server)r3r,r-r'r(r.r4r)r3r(r'rrVsc+s`|dkrtj�}t||d�}t||d��|j�fdd�|f|�EdH\}}t|�||�}||fS)z@Similar to `open_connection` but works with UNIX Domain Sockets.N)r(r')r'cs�S)Nrr)r)rrr*�sz&open_unix_connection.<locals>.<lambda>)rr+rrZcreate_unix_connectionr)�pathr'r(r.r/r0r1r2r)r)rr	}sc+s6�dkrtj�����fdd�}�j||f|�EdHS)z=Similar to `start_server` but works with UNIX Domain Sockets.Ncst��d�}t|��d�}|S)N)r(r')r')rr)r/r))r3r(r'rrr4�sz"start_unix_server.<locals>.factory)rr+Zcreate_unix_server)r3r5r'r(r.r4r)r3r(r'rr
�sc@s>eZdZdZd
dd�Zdd�Zdd�Zd	d
�Zedd��Z	dS)�FlowControlMixina)Reusable flow control logic for StreamWriter.drain().

    This implements the protocol methods pause_writing(),
    resume_reading() and connection_lost().  If the subclass overrides
    these it must call the super methods.

    StreamWriter.drain() must wait for _drain_helper() coroutine.
    NcCs0|dkrtj�|_n||_d|_d|_d|_dS)NF)rr+�_loop�_paused�
_drain_waiter�_connection_lost)rr'rrrr�szFlowControlMixin.__init__cCs,|jst�d|_|jj�r(tjd|�dS)NTz%r pauses writing)r8�AssertionErrorr7�	get_debugr�debug)rrrr�
pause_writing�s
zFlowControlMixin.pause_writingcCsP|js
t�d|_|jj�r&tjd|�|j}|dk	rLd|_|j�sL|jd�dS)NFz%r resumes writing)	r8r;r7r<rr=r9�done�
set_result)r�waiterrrr�resume_writing�s

zFlowControlMixin.resume_writingcCsVd|_|jsdS|j}|dkr"dSd|_|j�r4dS|dkrH|jd�n
|j|�dS)NT)r:r8r9r?r@�
set_exception)r�excrArrr�connection_lost�sz FlowControlMixin.connection_lostccsP|jrtd��|jsdS|j}|dks2|j�s2t�|jj�}||_|EdHdS)NzConnection lost)r:�ConnectionResetErrorr8r9�	cancelledr;r7�
create_future)rrArrr�
_drain_helper�s
zFlowControlMixin._drain_helper)N)
rr r!r"rr>rBrErrIrrrrr6�s
	r6csFeZdZdZd
�fdd�	Zdd�Z�fdd�Zd	d
�Zdd�Z�Z	S)ra=Helper class to adapt between Protocol and StreamReader.

    (This is a helper class instead of making StreamReader itself a
    Protocol subclass, because the StreamReader has other potential
    uses, and to prevent the user of the StreamReader to accidentally
    call inappropriate methods of the protocol.)
    Ncs*t�j|d�||_d|_||_d|_dS)N)r'F)rr�_stream_reader�_stream_writer�_client_connected_cb�	_over_ssl)rZ
stream_readerr3r')rrrr�s
zStreamReaderProtocol.__init__cCsd|jj|�|jd�dk	|_|jdk	r`t|||j|j�|_|j|j|j�}tj	|�r`|jj
|�dS)NZ
sslcontext)rJ�
set_transport�get_extra_inforMrLrr7rKrZiscoroutineZcreate_task)rr0�resrrr�connection_made�s


z$StreamReaderProtocol.connection_madecsF|jdk	r*|dkr|jj�n|jj|�t�j|�d|_d|_dS)N)rJ�feed_eofrCrrErK)rrD)rrrrE�s
z$StreamReaderProtocol.connection_lostcCs|jj|�dS)N)rJ�	feed_data)r�datarrr�
data_receivedsz"StreamReaderProtocol.data_receivedcCs|jj�|jrdSdS)NFT)rJrRrM)rrrr�eof_receiveds
z!StreamReaderProtocol.eof_received)NN)
rr r!r"rrQrErUrVr#rr)rrr�s
c@sjeZdZdZdd�Zdd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zddd�Z
edd��ZdS)ra'Wraps a Transport.

    This exposes write(), writelines(), [can_]write_eof(),
    get_extra_info() and close().  It adds drain() which returns an
    optional Future on which you can wait for flow control.  It also
    adds a transport property which references the Transport
    directly.
    cCs2||_||_|dks"t|t�s"t�||_||_dS)N)�
_transport�	_protocol�
isinstancerr;�_readerr7)rr0r)r/r'rrrrs
zStreamWriter.__init__cCs:|jjd|jg}|jdk	r,|jd|j�ddj|�S)Nztransport=%rz	reader=%rz<%s>� )rrrWrZ�append�join)r�inforrr�__repr__!s
zStreamWriter.__repr__cCs|jS)N)rW)rrrrr0'szStreamWriter.transportcCs|jj|�dS)N)rW�write)rrTrrrr`+szStreamWriter.writecCs|jj|�dS)N)rW�
writelines)rrTrrrra.szStreamWriter.writelinescCs
|jj�S)N)rW�	write_eof)rrrrrb1szStreamWriter.write_eofcCs
|jj�S)N)rW�
can_write_eof)rrrrrc4szStreamWriter.can_write_eofcCs
|jj�S)N)rW�close)rrrrrd7szStreamWriter.closeNcCs|jj||�S)N)rWrO)r�name�defaultrrrrO:szStreamWriter.get_extra_infoccsN|jdk	r |jj�}|dk	r |�|jdk	r:|jj�r:dV|jj�EdHdS)z~Flush the write buffer.

        The intended use is to write

          w.write(data)
          yield from w.drain()
        N)rZ�	exceptionrWZ
is_closingrXrI)rrDrrr�drain=s	



zStreamWriter.drain)N)rr r!r"rr_�propertyr0r`rarbrcrdrOrrhrrrrrs
c@s�eZdZedfdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
edd��Zedd��Zed'dd��Zed)dd��Zed d!��Zejr�ed"d#��Zed$d%��Zejr�d&d#�ZdS)*rNcCsZ|dkrtd��||_|dkr*tj�|_n||_t�|_d|_d|_d|_	d|_
d|_dS)NrzLimit cannot be <= 0F)�
ValueError�_limitrr+r7�	bytearray�_buffer�_eof�_waiter�
_exceptionrWr8)rr(r'rrrrXszStreamReader.__init__cCs�dg}|jr |jdt|j��|jr0|jd�|jtkrJ|jd|j�|jr`|jd|j�|jrv|jd|j�|jr�|jd|j�|j	r�|jd�d	d
j
|�S)Nrz%d bytes�eofzl=%dzw=%rze=%rzt=%rZpausedz<%s>r[)rmr\rrnrk�_DEFAULT_LIMITrorprWr8r])rr^rrrr_ks 


zStreamReader.__repr__cCs|jS)N)rp)rrrrrg}szStreamReader.exceptioncCs0||_|j}|dk	r,d|_|j�s,|j|�dS)N)rprorGrC)rrDrArrrrC�szStreamReader.set_exceptioncCs*|j}|dk	r&d|_|j�s&|jd�dS)z1Wakeup read*() functions waiting for data or EOF.N)rorGr@)rrArrr�_wakeup_waiter�s
zStreamReader._wakeup_waitercCs|jdkstd��||_dS)NzTransport already set)rWr;)rr0rrrrN�szStreamReader.set_transportcCs*|jr&t|j�|jkr&d|_|jj�dS)NF)r8rrmrkrW�resume_reading)rrrr�_maybe_resume_transport�sz$StreamReader._maybe_resume_transportcCsd|_|j�dS)NT)rnrs)rrrrrR�szStreamReader.feed_eofcCs|jo|jS)z=Return True if the buffer is empty and 'feed_eof' was called.)rnrm)rrrr�at_eof�szStreamReader.at_eofcCs�|jstd��|sdS|jj|�|j�|jdk	r�|jr�t|j�d|jkr�y|jj	�Wnt
k
rzd|_YnXd|_dS)Nzfeed_data after feed_eofrT)rnr;rm�extendrsrWr8rrkZ
pause_reading�NotImplementedError)rrTrrrrS�s
zStreamReader.feed_dataccsf|jdk	rtd|��|js&td��|jr<d|_|jj�|jj�|_z|jEdHWdd|_XdS)zpWait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        NzH%s() called while another coroutine is already waiting for incoming dataz_wait_for_data after EOFF)	ro�RuntimeErrorrnr;r8rWrtr7rH)rZ	func_namerrr�_wait_for_data�s


zStreamReader._wait_for_dataccs�d}t|�}y|j|�EdH}Wn�tk
rB}z|jSd}~Xnftk
r�}zJ|jj||j�rv|jd|j|�=n
|jj�|j	�t
|jd��WYdd}~XnX|S)a�Read chunk of data from the stream until newline (b'
') is found.

        On success, return chunk that ends with newline. If only partial
        line can be read due to EOF, return incomplete line without
        terminating newline. When EOF was reached while no bytes read, empty
        bytes object is returned.

        If limit is reached, ValueError will be raised. In that case, if
        newline was found, complete line including newline will be removed
        from internal buffer. Else, internal buffer will be cleared. Limit is
        compared against part of the line without newline.

        If stream was paused, this function will automatically resume it if
        needed.
        �
Nr)r�	readuntilrrrrm�
startswithr$�clearrurjr&)r�sep�seplen�line�errr�readline�s
 zStreamReader.readliner{ccs�t|�}|dkrtd��|jdk	r(|j�d}x�t|j�}|||kr||jj||�}|dkr\P|d|}||jkr|td|��|jr�t|j�}|jj	�t
|d��|jd�EdHq.W||jkr�td|��|jd||�}|jd||�=|j�t|�S)	aVRead data from the stream until ``separator`` is found.

        On success, the data and separator will be removed from the
        internal buffer (consumed). Returned data will include the
        separator at the end.

        Configured stream limit is used to check result. Limit sets the
        maximal length of data that can be returned, not counting the
        separator.

        If an EOF occurs and the complete separator is still not found,
        an IncompleteReadError exception will be raised, and the internal
        buffer will be reset.  The IncompleteReadError.partial attribute
        may contain the separator partially.

        If the data cannot be read because of over limit, a
        LimitOverrunError exception  will be raised, and the data
        will be left in the internal buffer, so it can be read again.
        rz,Separator should be at least one-byte stringNrz2Separator is not found, and chunk exceed the limitr|z2Separator is found, but chunk is longer than limit���)
rrjrprm�findrkrrn�bytesr~rrzru)rZ	separatorr��offsetZbuflenZisep�chunkrrrr|�s:






zStreamReader.readuntilrccs�|jdk	r|j�|dkrdS|dkrZg}x&|j|j�EdH}|sBP|j|�q*Wdj|�S|jrz|jrz|jd�EdHt|jd|��}|jd|�=|j	�|S)a�Read up to `n` bytes from the stream.

        If n is not provided, or set to -1, read until EOF and return all read
        bytes. If the EOF was received and the internal buffer is empty, return
        an empty bytes object.

        If n is zero, return empty bytes object immediately.

        If n is positive, this function try to read `n` bytes, and may return
        less or equal bytes than requested, but at least one byte. If EOF was
        received before any byte is read, this function returns empty byte
        object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        Nr��read)
rpr�rkr\r]rmrnrzr�ru)r�nZblocks�blockrTrrrr�Ps$

zStreamReader.readccs�|dkrtd��|jdk	r |j�|dkr,dSxFt|j�|krr|jr`t|j�}|jj�t||��|jd�EdHq.Wt|j�|kr�t|j�}|jj�nt|jd|��}|jd|�=|j	�|S)a�Read exactly `n` bytes.

        Raise an IncompleteReadError if EOF is reached before `n` bytes can be
        read. The IncompleteReadError.partial attribute of the exception will
        contain the partial read bytes.

        if n is zero, return empty bytes object.

        Returned value is not limited with limit, configured at stream
        creation.

        If stream was paused, this function will automatically resume it if
        needed.
        rz*readexactly size can not be less than zeroNr��readexactly)
rjrprrmrnr�r~rrzru)rr�Z
incompleterTrrrr��s&




zStreamReader.readexactlycCs|S)Nr)rrrr�	__aiter__�szStreamReader.__aiter__ccs|j�EdH}|dkrt�|S)Nr�)r��StopAsyncIteration)r�valrrr�	__anext__�szStreamReader.__anext__cCs|S)Nr)rrrrr��s)r{r�)r�)rr r!rrrr_rgrCrsrNrurRrvrSrrzr�r|r�r�r
ZPY35r�r�ZPY352rrrrrVs,	 [2*i)NN)NN)N)N)r"�__all__Zsocket�hasattrrw�rr
rrr�logrrr�EOFErrorr�	Exceptionrrrr	r
ZProtocolr6rrrrrrr�<module>sB
"B3G


📁