python (3.11.7)

(root)/
lib/
python3.11/
asyncio/
__pycache__/
streams.cpython-311.opt-1.pyc

ej~dZddlZddlZddlZddlZddlZeedredz
ZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddl
mZddlmZd
ZdeddZdeddZeedrdeddZdeddZGddejZGddeejZGddZGddZdS))StreamReaderStreamWriterStreamReaderProtocolopen_connectionstart_serverNAF_UNIX)open_unix_connectionstart_unix_server)
coroutines)events)
exceptions)format_helpers)	protocols)logger)sleepi)limitc	Ktj}t||}t||	|j	fd||fi|d{V\}}t|	||}||fS)aA 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.)
    rlooprcSNprotocolsC/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/asyncio/streams.py<lambda>z!open_connection.<locals>.<lambda>1sN)r
get_running_looprrcreate_connectionr)
hostportrkwdsrreader	transport_writerrs
         @rrrs&"$$D
D
1
1
1F#F666H//$..(,........LIq
)Xvt
<
<F6>rclKtjfd}j|||fi|d{VS)aStart 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 argument is 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.
    cNt}t|}|SNrrrrr%rclient_connected_cbrrs  rfactoryzstart_server.<locals>.factoryNs6E555'0C-1333rN)r
r 
create_server)r.r"r#rr$r/rs`  `  @rrr6so,"$$D$#GT4@@4@@@@@@@@@rcKtj}t||}t|||jfd|fi|d{V\}}t|||}||fS)z@Similar to `open_connection` but works with UNIX Domain Sockets.rrcSrrrsrrz&open_unix_connection.<locals>.<lambda>bsHrN)r
r rrcreate_unix_connectionr)	pathrr$rr%r&r'r(rs	        @rr	r	Zs&((E555'T:::8T8d,,&*,,,,,,,,	1i64@@v~rcjKtjfd}j||fi|d{VS)z=Similar to `start_server` but works with UNIX Domain Sockets.cNt}t|}|Sr+r,r-s  rr/z"start_unix_server.<locals>.factoryks6!D999F+F4G15777HOrN)r
r create_unix_server)r.r4rr$r/rs` `  @rr
r
fsm&((							-T,WdCCdCCCCCCCCCrc8eZdZdZd	dZdZdZdZdZdZ	dS)
FlowControlMixina)Reusable flow control logic for StreamWriter.drain().

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

    StreamWriter.drain() must wait for _drain_helper() coroutine.
    Nc|tjd|_n||_d|_t	j|_d|_dS)N)
stacklevelF)r
_get_event_loop_loop_pausedcollectionsdeque_drain_waiters_connection_lost)selfrs  r__init__zFlowControlMixin.__init__~sK</1===DJJDJ)/11 %rctd|_|jrtjd|dSdS)NTz%r pauses writing)r?r>	get_debugrdebugrDs r
pause_writingzFlowControlMixin.pause_writingsB:!!	4L,d33333	4	4rcd|_|jrtjd||jD]+}|s|d,dS)NFz%r resumes writing)r?r>rGrrHrBdone
set_resultrDwaiters  rresume_writingzFlowControlMixin.resume_writingss:!!	5L-t444)	(	(F;;==
(!!$'''	(	(rcd|_|jsdS|jD]C}|s-||d.||DdSNT)rCr?rBrLrM
set_exceptionrDexcrOs   rconnection_lostz FlowControlMixin.connection_lostsv $|	F)	.	.F;;==
.;%%d++++((---	.	.rc2K|jrtd|jsdS|j}|j|	|d{V|j|dS#|j|wxYw)NzConnection lost)rCConnectionResetErrorr?r>
create_futurerBappendremoverNs  r
_drain_helperzFlowControlMixin._drain_helpers 	:&'8999|	F))++""6***	/LLLLLLL&&v.....D&&v....sA::Bctr)NotImplementedErrorrDstreams  r_get_close_waiterz"FlowControlMixin._get_close_waiters!!rr)
__name__
__module____qualname____doc__rErJrPrVr\rarrrr9r9ts}&&&&444(((...
/
/
/"""""rr9cleZdZdZdZdfd	ZedZdZdZ	fdZ
dZd	Zd
Z
dZxZS)
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.)
    NcLt||&tj||_|j|_nd|_|||_d|_d|_d|_	d|_
||_d|_|j
|_dS)NrF)superrEweakrefref_stream_reader_wr_source_traceback_strong_reader_reject_connection_stream_writer_task
_transport_client_connected_cb	_over_sslr>rY_closed)rD
stream_readerr.r	__class__s    rrEzStreamReaderProtocol.__init__s
d###$%,[%?%?D"%2%DD""%)D"*#0D"'"
$7!z//11rc<|jdS|Sr)rkrIs r_stream_readerz#StreamReaderProtocol._stream_readers"!)4%%'''rcv|j}|j}||_||_|ddu|_dS)N
sslcontext)r>r&rorqget_extra_infors)rDr(rr&s    r_replace_writerz$StreamReaderProtocol._replace_writers>z$	$#"11,??tKrcXjrEddi}jr
j|d<j|dS_j}||ddu_	j
t|j_
|j}tj|r?fd}j|_j|d_dSdS)NmessagezpAn open stream was garbage collected prior to establishing network connection; call "stream.close()" explicitly.source_tracebackrzc|}|4jd|ddSdS)Nz*Unhandled exception in client_connected_cb)r~	exceptionr&)rr>call_exception_handlerclose)taskrUrDr&s  rcallbackz6StreamReaderProtocol.connection_made.<locals>.callbacksc..**C
99'S),)2;;
")))))
'r)rnrlr>rabortrqrx
set_transportr{rsrrrroriscoroutinecreate_taskrpadd_done_callbackrm)rDr&contextr%resrs``    rconnection_madez$StreamReaderProtocol.connection_madesg"
	@G
%
E.2.D*+J--g666OOF#$  +++"11,??tK$0".y$/5/3z#;#;D++F,0,?AAC%c**
7******"Z33C88

,,X666"&D)10rc|j}|,||n|||js7||jdn|j|t
|d|_d|_	d|_
d|_dSr)rxfeed_eofrSrtrLrMrhrVrkrorprq)rDrUr%rvs   rrVz$StreamReaderProtocol.connection_losts${!!!!$$S)))|  ""	0{''----**3///
$$$!%"
rcF|j}|||dSdSr)rx	feed_data)rDdatar%s   r
data_receivedz"StreamReaderProtocol.data_receiveds2$T"""""rcR|j}|||jrdSdS)NFT)rxrrs)rDr%s  reof_receivedz!StreamReaderProtocol.eof_receiveds6$OO>	5trc|jSr)rtr_s  rraz&StreamReaderProtocol._get_close_waiter)s
|rc	|j}|r*|s|dSdSdS#t$rYdSwxYwr)rtrL	cancelledrAttributeError)rDcloseds  r__del__zStreamReaderProtocol.__del__,s	#\F{{}}
#V%5%5%7%7
#  """""
#
#
#
#			DD	sA
AANN)rbrcrdrerlrEpropertyrxr|rrVrrrar
__classcell__)rvs@rrrs222222(((X(
LLL%'%'%'N$###
				#	#	#	#	#	#	#rrceZdZdZdZdZedZdZdZ	dZ
dZd	Zd
Z
dZdd
ZdZddddZdZdS)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.
    c||_||_||_||_|j|_|jddSr)rq	_protocol_readerr>rY
_complete_futrM)rDr&rr%rs     rrEzStreamWriter.__init__BsS#!
!Z5577%%d+++++rc|jjd|jg}|j|d|jdd|S)N
transport=zreader=<{}> )rvrbrqrrZformatjoinrDinfos  r__repr__zStreamWriter.__repr__Ls]')Ido)I)IJ<#KK2$,22333}}SXXd^^,,,rc|jSrrqrIs rr&zStreamWriter.transportRs
rc:|j|dSr)rqwriterDrs  rrzStreamWriter.writeVsd#####rc:|j|dSr)rq
writelinesrs  rrzStreamWriter.writelinesYs""4(((((rc4|jSr)rq	write_eofrIs rrzStreamWriter.write_eof\s((***rc4|jSr)rq
can_write_eofrIs rrzStreamWriter.can_write_eof_s,,...rc4|jSr)rqrrIs rrzStreamWriter.closebs$$&&&rc4|jSr)rq
is_closingrIs rrzStreamWriter.is_closinges))+++rcJK|j|d{VdSr)rrarIs rwait_closedzStreamWriter.wait_closedhs4n..t44444444444rNc8|j||Sr)rqr{)rDnamedefaults   rr{zStreamWriter.get_extra_infoks--dG<<<rcK|j|j}|||jrt	dd{V|jd{VdS)zyFlush the write buffer.

        The intended use is to write

          w.write(data)
          await w.drain()
        Nr)rrrqrrrr\)rDrUs  rdrainzStreamWriter.drainns<#,((**C	?%%''
	((NNNNNNNn**,,,,,,,,,,,r)server_hostnamessl_handshake_timeoutcK|jjdu}|j}|d{V|j|j|||||d{V}||_||dS)z3Upgrade an existing stream-based connection to TLS.N)server_siderr)rrrrr>	start_tlsrqr|)rDrzrrrr
new_transports       rrzStreamWriter.start_tlssn9E>jjll"j22OXz#_"7399999999
(  &&&&&rc|jsh|jrt	jdtdS|t	jd|tdSdS)Nzloop is closedz	unclosed )rqrr>	is_closedwarningswarnResourceWarningrrIs rrzStreamWriter.__del__s))++	Ez##%%
E
.@@@@@


2$22ODDDDD	E	Err)rbrcrdrerErrr&rrrrrrrr{rrrrrrrr8s,,,---X$$$)))+++///''',,,555====---4)-.2'''''EEEEErrceZdZdZedfdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZddZddZdZdZdZdS)rNcz|dkrtd||_|tj|_n||_t|_d|_d|_d|_	d|_
d|_|jr-tjtjd|_dSdS)NrzLimit cannot be <= 0Fr)
ValueError_limitr
r=r>	bytearray_buffer_eof_waiter
_exceptionrqr?rGr
extract_stacksys	_getframerl)rDrrs   rrEzStreamReader.__init__sA::3444</11DJJDJ {{	:!!	"%3%A
a  &"&"D"""	"	"rc\dg}|jr*|t|jd|jr|d|jt
kr|d|j|jr|d|j|jr|d|j|jr|d|j|j	r|dd	
d
|S)Nrz byteseofzlimit=zwaiter=z
exception=rpausedrr)rrZlenrr_DEFAULT_LIMITrrrqr?rrrs  rrzStreamReader.__repr__s,<	6KK3t|,,4445559	KK;.((KK...///<	4KK2$,22333?	:KK8T_88999?	:KK8T_88999<	"KK!!!}}SXXd^^,,,rc|jSr)rrIs rrzStreamReader.exceptions
rc||_|j}|2d|_|s||dSdSdSr)rrrrSrTs   rrSzStreamReader.set_exceptions]DL##%%
*$$S)))))
*
*rc|j}|2d|_|s|ddSdSdS)z1Wakeup read*() functions waiting for data or EOF.N)rrrMrNs  r_wakeup_waiterzStreamReader._wakeup_waitersVDL##%%
(!!$'''''
(
(rc||_dSrr)rDr&s  rrzStreamReader.set_transports
#rc|jr?t|j|jkr$d|_|jdSdSdS)NF)r?rrrrqresume_readingrIs r_maybe_resume_transportz$StreamReader._maybe_resume_transportsS<	-C--<< DLO**,,,,,	-	-<<rc<d|_|dSrR)rrrIs rrzStreamReader.feed_eofs!	rc |jo|jS)z=Return True if the buffer is empty and 'feed_eof' was called.)rrrIs rat_eofzStreamReader.at_eofsy---rcD|sdS|j|||jb|js]t|jd|jzkr?	|jd|_dS#t$rd|_YdSwxYwdSdSdS)NT)	rextendrrqr?rr
pause_readingr^rs  rrzStreamReader.feed_datas	FD!!!O'L
(DL!!AO33
$--/// $
'
'
'
'#'	
'
('''33s"BBBcK|jt|d|jr d|_|j|j|_	|jd{Vd|_dS#d|_wxYw)zpWait until feed_data() or feed_eof() is called.

        If stream was paused, automatically resume it.
        NzF() called while another coroutine is already waiting for incoming dataF)rRuntimeErrorr?rqrr>rY)rD	func_names  r_wait_for_datazStreamReader._wait_for_datas<#55566
6<	- DLO**,,,z//11	 ,DLLL4DLs"
A88	BcKd}t|}	||d{V}n#tj$r}|jcYd}~Sd}~wtj$r}|j||jr|jd|j|z=n|j	|
t|jdd}~wwxYw|S)aRead 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	readuntilrIncompleteReadErrorpartialLimitOverrunErrorr
startswithconsumedclearrrargs)rDsepseplenlinees     rreadlinezStreamReader.readline s S
	(,,,,,,,,DD-			9+	(	(	(|&&sAJ77
%L!5!*v"5!566""$$$((***QVAY'''
	(s(1CACCA:CCrcKt|}|dkrtd|j|jd}	t|j}||z
|krJ|j||}|dkrn|dz|z
}||jkrt
jd||jrBt|j}|j
t
j|d|dd{V||jkrt
jd	||jd||z}|jd||z=|
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 stringNTrz2Separator is not found, and chunk exceed the limitrz2Separator is found, but chunk is longer than limit)rrrrfindrrrrbytesrrrr)rD	separatorroffsetbuflenisepchunks       rrzStreamReader.readuntil?s(YQ;;KLLL?&/!*	3&&F&((|((F;;2:: !f,DK''$6L   y
Bdl++""$$$ 4UDAAA%%k222222222=	3@$+.DdLL
L^dVm^,L$-($$&&&U||rrcK|j|j|dkrdS|dkrQg}	||jd{V}|sn||9d|S|js"|js|dd{Vt|jd|}|jd|=|	|S)aRead up to `n` bytes from the stream.

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

        If `n` is 0, return an empty bytes object immediately.

        If `n` is positive, return at most `n` available bytes
        as soon as at least 1 byte is available in the internal buffer.
        If EOF is received before any byte is read, return an 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.
        NrrTread)
rr
rrZrrrrrr)rDnblocksblockrs     rr
zStreamReader.reads,?&/!663q55
F
%"ii44444444

e$$$	
%
88F###|	.DI	.%%f---------T\"1"%&&L!$$&&&rcK|dkrtd|j|j|dkrdSt|j|kr||jrBt|j}|jtj|||	dd{Vt|j|k|t|j|kr.t|j}|jn&t|jd|}|jd|=|
|S)aRead 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 zeroNrreadexactly)rrrrrrrrrrr)rDr
incompleters    rrzStreamReader.readexactlysK
q55IJJJ?&/!663$,!##y
D"4<00
""$$$ 4ZCCC%%m444444444
$,!##t|!!&&DL    bqb)**DRaR $$&&&rc|SrrrIs r	__aiter__zStreamReader.__aiter__srcXK|d{V}|dkrt|S)Nr)rStopAsyncIteration)rDvals  r	__anext__zStreamReader.__anext__s9MMOO#######::$$
r)r)r)rbrcrdrlrrErrrSrrrrrrrrrr
rrrrrrrrs4+$"""",---$***((($$$---
...$$$,   8>YYYYv1111f'''Rrrrr)__all__r@socketrrrihasattrrr
rrrlogrtasksrrrrr	r
Protocolr9rrrrrr<module>rsf'








769=<<G .8A+AAAAAB769D
)7




D&4DDDDD="="="="="y)="="="@A#A#A#A#A#+Y-?A#A#A#HcEcEcEcEcEcEcEcEJ``````````r