Nf:$.dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlZ ddlZn #e$rdZYnwxYwddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddl m!Z!dZ"dZ#dZ$e%e dZ&dZ'dZ(dZ)dZ*d%dZ+d&dZ,dZ-e%e drdZ.ndZ.dZ/Gdd ej0Z1Gd!d"ej2Z3Gd#d$ej4Z5dS)'aBase implementation of event loop. The event loop can be broken up into a multiplexer (the part responsible for notifying us of I/O events) and the event loop proper, which wraps a multiplexer with functionality for scheduling callbacks, immediately or at a given time in the future. Whenever a public API takes a callback, subsequent positional arguments will be passed to the callback if/when it is called. This avoids the proliferation of trivial lambdas implementing closures. Keyword arguments for the callback are not supported; this is a conscious design decision, leaving the door open for keyword arguments to modify the meaning of the API call itself. N) constants) coroutines)events) exceptions)futures) protocols)sslproto) staggered)tasks) transports)trsock)logger) BaseEventLoopServerdg?AF_INET6iQc|j}tt|ddtjrt |jSt|S)N__self__) _callback isinstancegetattrr Taskreprrstr)handlecbs */usr/lib/python3.11/asyncio/base_events.py_format_handlerFsF  B'"j$//<<BK   6{{ch|tjkrdS|tjkrdSt|S)Nzz) subprocessPIPESTDOUTr)fds r _format_piper&Os2 Z_x z zBxxr cttdstd |tjtjddS#t $rtdwxYw)N SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)hasattrsocket ValueError setsockopt SOL_SOCKETr(OSErrorsocks r_set_reuseportr1Xs 6> * *JDEEE J OOF-v/BA F F F F F J J JIJJ J Js +AA-c ^ttdsdS|dtjtjhvs|dS|tjkr tj}n|tjkr tj}ndS|d}net |tr |dkrd}nGt |tr |dkrd}n) t|}n#ttf$rYdSwxYw|tj kr4tj g}tr|tjn|g}t |tr|d}d|vrdS|D]V} tj||tr|tjkr |||d||||ffcS|||d||ffcS#t&$rYSwxYwdS)N inet_ptonrr idna%)r)r* IPPROTO_TCP IPPROTO_UDP SOCK_STREAM SOCK_DGRAMrbytesrint TypeErrorr+ AF_UNSPECAF_INET _HAS_IPv6appendrdecoder3r.) hostportfamilytypeprotoflowinfoscopeidafsafs r _ipaddr_inforLcs 6; ' ' Q*F,>??? Lt v!!!" " " ""t | D% TS[[ D#  42:: t99DD:&   44 !!!~  ( JJv ' ' 'h$#{{6"" d{{t     R & & & 9R6?224T47,KKKKK4T4L8888    D  4s*5CCC6FF F*)F*ctj}|D].}|d}||vrg||<|||/t|}g}|dkr4||dd|dz |dd|dz =|dt jt j |D|S)z-Interleave list of addrinfo tuples by family.rrNc3K|]}||V dSN).0as r z(_interleave_addrinfos..s0 ] ]]]r ) collections OrderedDictrAlistvaluesextend itertoolschain from_iterable zip_longest) addrinfosfirst_address_family_countaddrinfos_by_familyaddrrEaddrinfos_lists reordereds r_interleave_addrinfosrcs$&13311a , , ,*,  'F#**40000.557788OI!A%%+,K-G!-K,KLMMM A > :Q >> ? ?00  !? 3   r c|s2|}t|ttfrdSt j|dSrO) cancelled exceptionr SystemExitKeyboardInterruptr _get_loopstop)futexcs r_run_until_complete_cbrmsa ==??mmoo cJ(9: ; ;  F c!!!!!r TCP_NODELAYc|jtjtjhvrW|jtjkrD|jtjkr1|tjtj ddSdSdSdSNr) rEr*r?rrFr9rGr7r,rnr/s r _set_nodelayrqsn KFNFO< < < V/// f000 OOF.0BA F F F F F = <//00r cdSrOrPr/s rrqrqs r cjt)t|tjrtddSdS)Nz"Socket cannot be of type SSLSocket)sslr SSLSocketr=r/s r_check_ssl_socketrvs1 :dCM::<===r cDeZdZdZdZdZdZdZdZdZ dZ d Z d S) _SendfileFallbackProtocolct|tjstd||_||_||_|j |_ | | ||j r%|jj |_dSd|_dS)Nz.transport should be _FlowControlMixin instance)rr _FlowControlMixinr= _transport get_protocol_proto is_reading_should_resume_reading_protocol_paused_should_resume_writing pause_reading set_protocol_loop create_future_write_ready_fut)selftransps r__init__z"_SendfileFallbackProtocol.__init__s&*">?? NLMM M ))++ &,&7&7&9&9#&,&=#D!!!  & )$(O$9$G$G$I$ID ! ! !$(D ! ! !r cK|jrtd|j}|dS|d{VdS)NzConnection closed by peer)r{ is_closingConnectionErrorr)rrks rdrainz_SendfileFallbackProtocol.drainsR ? % % ' ' ?!"=>> ># ; F r c td)Nz?Invalid state: connection should have been established already. RuntimeError)r transports rconnection_madez)_SendfileFallbackProtocol.connection_madesNOO Or c|jD|(|jtdn|j||j|dS)NzConnection is closed by peer)r set_exceptionrr}connection_lost)rrls rrz)_SendfileFallbackProtocol.connection_lostsw  ,{%33#$BCCEEEE%33C888 ##C(((((r c^|jdS|jj|_dSrO)rr{rrrs r pause_writingz'_SendfileFallbackProtocol.pause_writings/  , F $ 5 C C E Er cZ|jdS|jdd|_dS)NF)r set_resultrs rresume_writingz(_SendfileFallbackProtocol.resume_writings5  ( F ((/// $r c tdNz'Invalid state: reading should be pausedr)rdatas r data_receivedz'_SendfileFallbackProtocol.data_receivedDEEEr c tdrrrs r eof_receivedz&_SendfileFallbackProtocol.eof_receivedrr c K|j|j|jr|j|j|j|jr|jdSdSrO) r{rr}rresume_readingrcancelrrrs rrestorez!_SendfileFallbackProtocol.restores $$T[111  & - O * * , , ,  ,  ! ( ( * * *  & ) K & & ( ( ( ( ( ) )r N) __name__ __module__ __qualname__rrrrrrrrrrPr rrxrxs ) ) )OOO ) ) )FFF %%% FFFFFF ) ) ) ) )r rxcpeZdZ ddZdZdZdZdZdZdZ d Z e d Z d Z d Zd ZdZdS)rNc||_||_d|_g|_||_||_||_||_||_d|_ d|_ dS)NrF) r_sockets _active_count_waiters_protocol_factory_backlog _ssl_context_ssl_handshake_timeout_ssl_shutdown_timeout_serving_serving_forever_fut)rloopsocketsprotocol_factory ssl_contextbacklogssl_handshake_timeoutssl_shutdown_timeouts rrzServer.__init__s[   !1 '&;#%9" $(!!!r c2d|jjd|jdS)N) __class__rrrs r__repr__zServer.__repr__"s"F4>*FFT\FFFFr c8|jJ|xjdz c_dSrp)rrrs r_attachzServer._attach%s*}((( ar c|jdksJ|xjdzc_|jdkr|j|dSdSdS)Nrr)rr_wakeuprs r_detachzServer._detach)s^!A%%%% a   " "t}'< LLNNNNN # "'<'K|]}tj|VdSrO)rTransportSocket)rQss rrSz!Server.sockets..Ks-FF1V+A..FFFFFFr )rtuplers rrzServer.socketsGs. = 2FF FFFFFFr c8|j}|dSd|_|D]}|j|d|_|j9|js |jd|_|jdkr|dSdS)NFr) rr _stop_servingrrrrrr)rrr0s rclosez Server.closeMs- ? F  + +D J $ $T * * * *  % 1-2244 2  % , , . . .(,D %   " " LLNNNNN # "r cfK|tjdd{VdS)Nr)rr sleeprs r start_servingzServer.start_serving`s@ k!nnr cK|jtd|d|jtd|d||j|_ |jd{VnH#t j$r6 || d{V#xYwwxYw d|_dS#d|_wxYw)Nzserver z, is already being awaited on serve_forever()z is closed) rrrrrrrCancelledErrorr wait_closedrs r serve_foreverzServer.serve_foreverfs(  $ 0N$NNNPP P = ;;;;<< < $(J$<$<$>$>! -+ + + + + + + + +(     &&(((((((((   ,)-D % % %D % , , , ,s6* A87C 8B=.B76B=7B99B==C CcK|j|jdS|j}|j||d{VdSrO)rrrrrA)rrs rrzServer.wait_closed{sX = DM$9 F))++ V$$$ r rO)rrrrrrrrrrrpropertyrrrrrrPr rrrs>B ) ) ) )GGG    *** , , ,GGXG & ---*r rc JeZdZdZdZdZddddZdZdZd\ddd d Z d\d dddddd d dZ d]dZ d^dZ d^dZ d\dZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Zejfd"Z d#Z!d$Z"dd%d&Z#dd%d'Z$dd%d(Z%d)Z&d*Z'd+Z(dd%d,Z)d-Z*d.Z+d/Z,d0d0d0d0d1d2Z-d_d3Z.d`d d4d5Z/d6Z0d7Z1d8Z2d\d9Z3 d^dd0d0d0dddddddd: d;Z4 dad<Z5d`d d4d=Z6d>Z7d?Z8d dddd@dAZ9 d^d0d0d0ddddBdCZ:d0e;j<d0d0d1dDZ=dEZ> d^e;j?e;j@ddFdddddd dG dHZAddddIdJZBdKZCdLZDdMZEeFjGeFjGeFjGd d d0ddddN dOZHeFjGeFjGeFjGd d d0ddddN dPZIdQZJdRZKdSZLdTZMdUZNdVZOdWZPdXZQdYZRdZZSd[ZTdS)brcd|_d|_d|_tj|_g|_d|_d|_d|_ tj dj |_ d|_|t!jd|_d|_d|_d|_d|_t/j|_d|_d|_dS)NrF monotonicg?)_timer_cancelled_count_closed _stoppingrTdeque_ready _scheduled_default_executor _internal_fds _thread_idtimeget_clock_info resolution_clock_resolution_exception_handler set_debugr_is_debug_modeslow_callback_duration_current_handle _task_factory"_coroutine_origin_tracking_enabled&_coroutine_origin_tracking_saved_depthweakrefWeakSet _asyncgens_asyncgens_shutdown_called_executor_shutdown_calledrs rrzBaseEventLoop.__init__s&'# !')) !%!%!4[!A!A!L"& z022333'*##!27/6:3"/++*/').&&&r c d|jjd|d|d|d S)Nrz running=z closed=z debug=r)rr is_running is_closed get_debugrs rrzBaseEventLoop.__repr__sp C' C C$//2C2C C Cnn&& C C/3~~/?/? C C C r c,tj|S)z,Create a Future object attached to the loop.r)rFuturers rrzBaseEventLoop.create_futures~4((((r N)namecontextc||j(tj||||}|jr|jd=nF||||}n||||}tj|||S)zDSchedule a coroutine object. Return a task object. N)rrrr) _check_closedrr r_source_traceback_set_task_name)rcororrtasks r create_taskzBaseEventLoop.create_tasks    %:dD'JJJD% /*2.))$55))$g)FF  t , , , r cT|t|std||_dS)awSet a task factory that will be used by loop.create_task(). If factory is None the default task factory will be set. If factory is a callable, it should have a signature matching '(loop, coro)', where 'loop' will be a reference to the active event loop, 'coro' will be a coroutine object. The callable must return a Future. Nz'task factory must be a callable or None)callabler=r)rfactorys rset_task_factoryzBaseEventLoop.set_task_factorys4  x'8'8 EFF F$r c|jS)zz4BaseEventLoop.shutdown_asyncgens..(s 2 2 2bbiikk 2 2 2r return_exceptionsz;an error occurred during closing of asynchronous generator )messagerfasyncgen) rlenrrVclearr gatherzipr Exceptioncall_exception_handler)r closing_agensresultsresultrFs rshutdown_asyncgensz BaseEventLoop.shutdown_asyncgenss *.'4?##  FT_--   2 2M 2 2 2$"$$$$$$$$ 77  LFD&),, ++ B9= B B!' $ --  r cKd|_|jdS|}tj|j|f}| |d{V|dS#|wxYw)z.Schedule the shutdown of the default executor.TN)targetr1)rrr threadingThread _do_shutdownstartjoin)rfuturethreads rshutdown_default_executorz'BaseEventLoop.shutdown_default_executor4s)-&  ! ) F##%%!):&KKK  LLLLLLL KKMMMMMFKKMMMMs A66B c: |jd|s||jddSdS#t $r@}|s!||j|Yd}~dSYd}~dSd}~wwxYw)NTwait)rshutdownrrCrr[r)rrhexs rrezBaseEventLoop._do_shutdownAs D  " + + + 6 6 6>>## C))&*;TBBBBB C C D D D>>## D))&*>CCCCCCCCC D D D D D D DsA A B/BBc|rtdtjtddS)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)rrr_get_running_looprs r_check_runningzBaseEventLoop._check_runningJsS ??   ECDD D  # % % 1IKK K 2 1r c||||jt j} t j|_t j |j |j tj | ||jrn d|_d|_tj d|dt j |dS#d|_d|_tj d|dt j |wxYw)zRun until stop() is called.) firstiter finalizerTFN)r rr_set_coroutine_origin_tracking_debugsysget_asyncgen_hooksrc get_identrset_asyncgen_hooksrOrGr_set_running_loop _run_oncer)rold_agen_hookss r run_foreverzBaseEventLoop.run_foreverQsX   ++DK888/11 4'133DO  "T-J-1-J L L L L  $T * * *    > "DN"DO  $T * * *  / / 6 6 6  "N 3 3 3 3 #DN"DO  $T * * *  / / 6 6 6  "N 3 3 3sA*D AEc||tj| }t j||}|rd|_|t | nD#|r<| r(| s| xYw | tn#| twxYw| std|S)a\Run until the Future is done. If the argument is a coroutine, it is wrapped in a Task. WARNING: It would be disastrous to call run_until_complete() with the same coroutine twice -- it would wrap it in two different Tasks and that can't be good. Return the Future's result, or raise its exception. rFz+Event loop stopped before Future completed.)r rrrisfuturer ensure_future_log_destroy_pendingadd_done_callbackrmrrrerfremove_done_callbackrr_)rrhnew_tasks rrun_until_completez BaseEventLoop.run_until_completeisD  '///$V$777  0+0F '  !7888 @         #FKKMM #&2B2B2D2D #  """    ' '(> ? ? ? ?F ' '(> ? ? ? ?{{}} NLMM M}}s8B C- ACC--D cd|_dS)zStop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rrs rrjzBaseEventLoop.stops r cf|rtd|jrdS|jrt jd|d|_|j|jd|_ |j }|d|_ | ddSdS)zClose the event loop. This clears the queues and shuts down the executor, but does not wait for the executor to finish. The event loop must not be running. z!Cannot close a running event loopNzClose %rTFrl) rrrrwrdebugrrXrrrrnrexecutors rrzBaseEventLoop.closes ??   DBCC C <  F ; + LT * * *   )-&)  %)D "   5  ) ) ) ) ) r c|jS)z*Returns True if the event loop was closed.)rrs rrzBaseEventLoop.is_closeds |r c|s@|d|t||s|dSdSdS)Nzunclosed event loop rI)rrMrr)r_warns r__del__zBaseEventLoop.__del__sk~~  E111?4 P P P P??$$      r c|jduS)z*Returns True if the event loop is running.N)rrs rrzBaseEventLoop.is_runningst+,r c(tjS)zReturn the time according to the event loop's clock. This is a float expressed in seconds since an epoch, but the epoch, precision, accuracy and drift are unspecified and may differ per event loop. )rrrs rrzBaseEventLoop.times~r r c|td|j||z|g|Rd|i}|jr|jd=|S)a8Arrange for a callback to be called at a given time. Return a Handle: an opaque object with a cancel() method that can be used to cancel the call. The delay can be an int or float, expressed in seconds. It is always relative to the current time. Each callback will be called exactly once. If two callbacks are scheduled for exactly the same time, it undefined which will be called first. Any positional arguments after the callback will be passed to the callback when it is called. Nzdelay must not be Nonerr )r=call_atrr )rdelaycallbackrr1timers r call_laterzBaseEventLoop.call_latersp =455 5 TYY[[50(.T...%,..  " ,'+ r cB|td||jr*|||dt j|||||}|jr|jd=tj |j |d|_ |S)z|Like call_later(), but uses an absolute time. Absolute time corresponds to the event loop's time() method. Nzwhen cannot be Nonerr T) r=r rw _check_thread_check_callbackr TimerHandler heapqheappushr)rwhenrrr1rs rrzBaseEventLoop.call_ats <122 2  ; 6     9 5 5 5"44wGG  " ,'+ t... r c||jr*|||d||||}|jr|jd=|S)aTArrange for a callback to be called as soon as possible. This operates as a FIFO queue: callbacks are called in the order in which they are registered. Each callback will be called exactly once. Any positional arguments after the callback will be passed to the callback when it is called. call_soonr )r rwrr _call_soonr rrrr1rs rrzBaseEventLoop.call_soonsx  ; 8     ; 7 7 7499  # -(, r ctj|stj|rtd|dt |std|d|dS)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r iscoroutineiscoroutinefunctionr=r)rrmethods rrzBaseEventLoop._check_callbacks  "8 , , >.x88 ><&<<<>> >!! %$V$$$$%% % % %r ctj||||}|jr|jd=|j||S)Nr )rHandler rrA)rrr1rrs rrzBaseEventLoop._call_soon sHxtW==  # -(, 6""" r cr|jdStj}||jkrtddS)aoCheck that the current thread is the thread running the event loop. Non-thread-safe methods of this class make this assumption and will likely behave incorrectly when the assumption is violated. Should only be called when (self._debug == True). The caller is responsible for checking this condition for performance reasons. NzMNon-thread-safe operation invoked on an event loop other than the current one)rrcrzr)r thread_ids rrzBaseEventLoop._check_threadsK ? " F'))  ' ''(( ( ( 'r c||jr||d||||}|jr|jd=||S)z"Like call_soon(), but thread-safe.rCr )r rwrrr r:rs rrCz"BaseEventLoop.call_soon_threadsafe$sx  ; C  +A B B B499  # -(,  r c4||jr||d|D|j}||'t jd}||_t j|j |g|R|S)Nrun_in_executorasyncio)thread_name_prefixr) r rwrrr@ concurrentrThreadPoolExecutor wrap_futuresubmit)rrfuncr1s rrzBaseEventLoop.run_in_executor/s  ; :  '8 9 9 9  -H  ( ( * * *%-@@'0A*2&" HOD (4 ( ( (t555 5r cpt|tjjst d||_dS)Nz,executor must be ThreadPoolExecutor instance)rrrrr=rrs rset_default_executorz"BaseEventLoop.set_default_executor?s8(J$6$IJJ LJKK K!)r cH|d|g}|r|d||r|d||r|d||r|d|d|}tjd||}t j||||||} ||z } d|d | d zd d | }| |jkrtj|ntj|| S) N:zfamily=ztype=zproto=zflags=, zGet address info %szGetting address info z took g@@z.3fzms: ) rArgrrrr* getaddrinforinfo) rrCrDrErFrGflagsmsgt0addrinfodts r_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugDsY!!!!"  - JJ+++ , , ,  ) JJ't'' ( ( (  + JJ))) * * *  + JJ))) * * *iinn *C000 YY[[%dD&$uMM YY[[2 OcOOcOOO8OO , , , K     L   r rrErFrGrc K|jr|j}n tj}|d|||||||d{VSrO)rwrr*rr)rrCrDrErFrGr getaddr_funcs rrzBaseEventLoop.getaddrinfo\sr ; .2LL!-L)) ,dFD%HHHHHHHH Hr cVK|dtj||d{VSrO)rr* getnameinfo)rsockaddrrs rrzBaseEventLoop.getnameinfofsH)) &$h77777777 7r )fallbackchK|jr'|dkrtdt|||||| |||||d{VS#t j$r }|sYd}~nd}~wwxYw|||||d{VS)Nrzthe socket must be non-blocking) rw gettimeoutr+rv_check_sendfile_params_sock_sendfile_nativerSendfileNotAvailableError_sock_sendfile_fallback)rr0fileoffsetcountrrls r sock_sendfilezBaseEventLoop.sock_sendfilejs9 ; @4??,,11>?? ?$ ##D$>>> 33D$4:ECCCCCCCC C3          11$28%AAAAAAAA AsA77BBBc<Ktjd|d|d)Nz-syscall sendfile is not available for socket z and file z combinationrrrr0rrrs rrz#BaseEventLoop._sock_sendfile_nativeys@2 -D - - - - -.. .r c|K|r|||rt|tjn tj}t |}d} |rt||z |}|dkrnft |d|}|d|j|d{V} | sn*|||d| d{V|| z }||dkr)t|dr|||zSSS#|dkr)t|dr|||zwwwxYw)NrTseek) rminr!SENDFILE_FALLBACK_READBUFFER_SIZE bytearray memoryviewrreadinto sock_sendallr)) rr0rrr blocksizebuf total_sentviewreads rrz%BaseEventLoop._sock_sendfile_fallbacks   IIf    FCyB C C C#E  ""  / # #EJ$6 B BI A~~!#z z2!11$ tLLLLLLLL''d5D5k:::::::::d"  #A~~'$"7"7~ &:-....~zA~~'$"7"7~ &:-....~s BD 2D;cdt|ddvrtd|jtjkstd|_t |t s"td||dkr"td|t |t s"td||dkr"td|dS)Nbmodez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})rz0offset must be a non-negative integer (got {!r})) rr+rFr*r9rr<r=formatrs rrz$BaseEventLoop._check_sendfile_paramss) gdFC00 0 0CDD DyF...JKK K  eS)) QAHHOOQQQzz AHHOOQQQ&#&& BII  A::BII  :r cKg}|j||\}}}}} d} tj|||} | d||D]\} }}}} | |kr | | n#t$rS} d| d| j}t | j|} || Yd} ~ d} ~ wwxYw|r|t d|d| | | d{V| dx}}S#t$r1} || | | d} ~ w| | xYw#dx}}wxYw)z$Create, bind and connect one socket.NrErFrGF*error while attempting to bind on address : z&no matching local address with family=z found) rAr* setblockingbindr.strerrorlowererrnopop sock_connectr)rr addr_infolocal_addr_infos my_exceptionsrEtype_rG_r(r0lfamilyladdrrlrs r _connect_sockzBaseEventLoop._connect_socks  -(((+4(ua$ .=U%HHHD   U # # #+/?YY+GQ1e&((  2 %((("2226',66"|113366 &ci55%,,S111111112%Y+//111%&W&W&W&WXXX##D'22 2 2 2 2 2 2 2*. -J      % % %   )- -J - - - -sO?D" A75D"7 CA C D"CA D"" E4,,EE44E77E=) rtrErGrr0 local_addrr!rrhappy_eyeballs_delay interleavec vK| |std| |r|std|} | |std| |std|t|| |d}|||td||f|tj||d{V}|st d | =| |tj||d{Vst d nd|rt ||}g| 5|D]1} |d{V}n#t $rY.wxYwn/tj fd |D| d{V\}}}|d D tdkrd td tfdDrd t d ddD#dwxYwn8|td|jtjkrtd||||| | | d{V\}}jr.|d}t'jd|||||||fS)aConnect to a TCP server. Create a streaming transport connection to a given internet host and port: socket family AF_INET or socket.AF_INET6 depending on host (or family if specified), socket type SOCK_STREAM. protocol_factory must be a callable returning a protocol instance. This method is a coroutine which will try to establish the connection in the background. When successful, the coroutine returns a (transport, protocol) pair. Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host1ssl_handshake_timeout is only meaningful with ssl0ssl_shutdown_timeout is only meaningful with sslr8host/port and sock can not be specified at the same timerErFrGrr!getaddrinfo() returned empty listc3PK|] }tjj|V!dSrO) functoolspartialr)rQrr laddr_infosrs rrSz2BaseEventLoop.create_connection..4sR,,!&t'9'18[JJ,,,,,,r rcg|] }|D]}| SrPrP)rQsubrls rrSz3BaseEventLoop.create_connection..:s%GGGc3GGCcGGGGr rc3>K|]}t|kVdSrOr)rQrlmodels rrSz2BaseEventLoop.create_connection..As.GGSs3xx50GGGGGGr zMultiple exceptions: {}rc34K|]}t|VdSrOr )rQrls rrSz2BaseEventLoop.create_connection..Fs(%E%E3c#hh%E%E%E%E%E%Er z5host and port was not specified and no sock specified"A Stream Socket was expected, got )rrr*z%r connected to %s:%r: (%r, %r))r+rv_ensure_resolvedr*r9r.rcrr staggered_racerWrallrrgrF_create_connection_transportrwget_extra_inforr)rrrCrDrtrErGrr0rr!rrrrinfosrrrrrrr s` @@@rcreate_connectionzBaseEventLoop.create_connections&  &s &JKK K  "s " B "ABBB"O ,S ,CEE E +C +BDD D   d # # #  + 0BJ  t/ NPPP//t V'uE0NNNNNNNNE CABBB%$($9$9v+5d%:%,%,,,,,,, #G!"EFFFG#  A-eZ@@J#+ %!!H!%)%7%7&+&?&? ? ? ? ? ? ?"!!! !$-#;,,,,,,%*,,,)t $5$5$5555555 a |GGZGGG  &:!++(m+!$JqM 2 2GGGGJGGGGG0",Q-/&&?&F&F II%E%E*%E%E%EEE'G'GHHH"&J%%%%$| KMMMyF...!AAACCC%)$E$E "C"7!5%F%7%7777777 8 ; @++H55D L:tT9h @ @ @(""sD== E  E  BHH"c \K|d|}|} |r7t|trdn|} |||| | ||||} n|||| } | d{Vn#| xYw| |fS)NFr r!rr)rrrboolr&rr) rr0rrtr!r rrrrr%rs rrz*BaseEventLoop._create_connection_transportds ##%%##%%  L!+C!6!6?CJ00h F'&;%9 1;;II 33D(FKKI LLLLLLLL  OO    (""s BB'cK|rtdt|dtjj}|tjjurtd||tjjur> |||||d{VS#tj $r }|sYd}~nd}~wwxYw|std|| ||||d{VS)aSend a file to transport. Return the total number of bytes which were sent. The method uses high-performance os.sendfile if available. file must be a regular file object opened in binary mode. offset tells from where to start reading the file. If specified, count is the total number of bytes to transmit as opposed to sending the file until EOF is reached. File position is updated on return or also in case of error in which case file.tell() can be used to figure out the number of bytes which were sent. fallback set to True makes asyncio to manually read and send the file when the platform does not support the sendfile syscall (e.g. Windows or SSL socket on Unix). Raise SendfileNotAvailableError if the system does not support sendfile syscall and fallback is False. zTransport is closing_sendfile_compatiblez(sendfile is not supported for transport NzHfallback is disabled and native sendfile is not supported for transport ) rrrr _SendfileMode UNSUPPORTED TRY_NATIVE_sendfile_nativerr_sendfile_fallback)rrrrrrrrls rsendfilezBaseEventLoop.sendfiles0    ! ! 7566 6y"8 .:<< 9*6 6 6H9HHJJ J 9*5 5 5 !229d395BBBBBBBBB7     :9+499:: :,,Y-3U<<<<<<<< E88A Grc Kttdt|tjst d|t |ddst d|d|}tj||||||||d } | | | | | j |} | |j } |d{VnK#t$r>|| | wxYw| jS) zzUpgrade transport to TLS. Return a new transport that *protocol* should start using immediately. Nz"Python ssl module is not availablez@sslcontext is expected to be an instance of ssl.SSLContext, got _start_tls_compatibleFz transport z is not supported by start_tls())rrr")rtrr SSLContextr=rrr SSLProtocolrrrrr BaseExceptionrr_app_transport) rrrr%r r!rrr ssl_protocol conmade_cb resume_cbs r start_tlszBaseEventLoop.start_tlss ;CDD D*cn55 '&!&&'' 'y"95AA LJYJJJLL L##%%+ (J "7!5!& (((  !!!|,,,^^L$@)LL NN9#;<<  LLLLLLLL    OO                   **s 9DAE )rErGr reuse_portallow_broadcastr0c K| | jtjkrtd| s s |s|s|s|s|rZt |||||} dd| D} td| d| dd} ns s|d krtd ||fd ff} nttd r|tj krfD](}|$t|tstd )rd dvry tjtj jrtjn8#t$$rYn,t&$r }t)jd|Yd}~nd}~wwxYw||ffff} ni}d fdffD]\}}|t|t,rt/|dkstd|||tj|||d{V}|st'd|D]"\}}}}}||f}||vrddg||<||||<#fd|D} | stdg}| D]\\}}\}}d} d} tj|tj|} |rt3| |r+| tjtjd| dr| |r |s|| |d{V|} n\#t&$r0}| | |j |Yd}~d}~w| | xYw|d |}|!}|"| || |}|j#r2rt)j$d||nt)j%d|| |d{Vn#|xYw||fS)zCreate datagram connection.NzA UDP Socket was expected, got )r remote_addrrErGrr.r/rc3.K|]\}}||d|VdS)=NrP)rQkvs rrSz9BaseEventLoop.create_datagram_endpoint..s5$N$NDAqA$NZZAZZ$N$N$N$N$N$Nr zKsocket modifier keyword arguments can not be used when sock is specified. ()Frzunexpected address familyNNAF_UNIXzstring is expected)rz2Unable to check or remove stale UNIX socket %r: %rrz2-tuple is expectedrrcFg|]\}}r|dr|d||fS)rNrrP)rQkey addr_pairrr1s rrSz:BaseEventLoop.create_datagram_endpoint..AsU#E#E#E)7i'#E,5aL,@(-A-6q\-A)$-A-A-Ar zcan not get address informationrz@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))&rFr*r:r+dictrgitemsrr)r8rrr=statS_ISSOCKosst_moderemoveFileNotFoundErrorr.rerrorrrWrr1r,r- SO_BROADCASTrrrrArr)rwrr)rrrr1rErGrr.r/r0optsproblemsr_addraddr_pairs_infor`err addr_infosidxrfamrpror(r<r local_addressremote_addressrlrrrs `` rcreate_datagram_endpointz&BaseEventLoop.create_datagram_endpointsO  yF--- >d>>@@@ =k = =# =', = ="1 =z{#)e'1,;=== 99$N$NDJJLL$N$N$NNN <08<<<===   U # # #FF2 H+2 HQ;;$%@AAA%+UO\#B"D++. H&.0H0H'5>>D' 40E0E''(<=== 6*Q-{"B"B 6=)<)<)DEE2Ij111,"666 &5%/666666666 &,UO%/$=$?#B #$j/A{3C!D;;IC' *4 7 7CCIINN"+,A"B"BB&*&;&; f6G"'u4'<'A'A!A!A!A!A!A!A %O")*M"N"NN7<;;3CCG#&*C"*4437, 33:JsOC00#E#E#E#E#E;E;K;K;M;M#E#E#E 'H$%FGGGJ6E $ $2&%0-!=%F,=ULLLD!-&t,,,&G"-v/BAGGG$$U+++!1 -000"0.J"&"3"3D."I"IIIIIIII!/E+++' %J%c********' !m###%%##%%11 (FF,, ; ? ? 0& YJJJJ (()X??? LLLLLLLL  OO    (""sC0?E00 F%< F%F  F%#B-M N#&NN#P''P>cK|dd\}}t|||||g|ddR} | | gS|||||||d{VS)Nr:r)rLr) rr(rErFrGrrrCrDrs rrzBaseEventLoop._ensure_resolvedsRaR[ dD$eJgabbkJJJ  6M))$V$05U*DDDDDDDD Dr cK|||f|tj||d{V}|std|d|S)N)rErFrrz getaddrinfo(z) returned empty list)rr*r9r.)rrCrDrErrs r_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfos++T4L171C27d,DDDDDDDD HFFFFGG G r r) rErr0rrt reuse_addressr.rrrc Kt|trtd| |td| |td|t ||m|td| t jdkotjdk} g}|dkrdg}n:t|tst|tj j s|g}n|}fd |D}tj|d{V}tt j|}d } |D]]}|\}}}}} t'j|||}n5#t&j$r#jrt-jd |||d YTwxYw||| r+|t&jt&jd | rt9|t:rP|t&jkr@t?t&dr+|t&j t&j!d  |"|#tF$r8}tG|j$d|d|j%&dd}~wwxYwd }|s|D]}|'n\#|s|D]}|'wwxYw|td|j(t&j)krtd||g}|D]}|*d tW||||| | }| r.|,tj-dd{Vjrt-j.d||S)a1Create a TCP server. The host parameter can be a string, in that case the TCP server is bound to host and port. The host parameter can also be a sequence of strings and in that case the TCP server is bound to all hosts of the sequence. If a host appears multiple times (possibly indirectly e.g. when hostnames resolve to the same IP address), the server is only bound once to that host. Return a Server object which can be used to stop the service. This method is a coroutine. z*ssl argument must be an SSLContext or NoneNrrrposixcygwinr4cBg|]}|S))rEr)rV)rQrCrErrDrs rrSz/BaseEventLoop.create_server..sG%%%11$V8=2??%%%r Fz:create_server() failed to create socket.socket(%r, %r, %r)Texc_info IPPROTO_IPV6rrz)Neither host/port nor sock were specifiedrrz %r is serving)/rrr=r+rvrBrrxplatformrrTabcIterabler rYsetrYrZr[r*rFrwrwarningrAr,r- SO_REUSEADDRr1r@rr)r^ IPV6_V6ONLYrr.rrrrrFr9rrrrr)rrrCrDrErr0rrtrWr.rrrrhostsfsr completedresrKsocktyperG canonnamesarLrs` ``` r create_serverzBaseEventLoop.create_servers8 c4  JHII I ,CEE E + BDD D   d # # #  t/ NPPP$ "7 2 Os|x7O GrzzT3''  {'?@@ %%%%%%%#%%%B ,+++++++E 55e<<==EI% % NNC9<6B%B!%}R5AA!<!!!;O"N,G+-xOOOO! !NN4((($J"-v/BDJJJ!-&t,,,".&/11#FN;;2(;(.(:(,...N " "NNN%cii)+S\-?-?-A-A-A2CDDIMNN!  % '%% !% '%% %%| !LMMMyF... !Nd!N!NOOOfG $ $D   U # # # #g'7W&;,..  !  ! ! # # #+a.. ; 1 K 0 0 0 sU4 J3EJ3/F J3 F  B-J39IJ3 J3J  JJ33K)rtrrc zK|jtjkrtd|||std||std|t |||||dd||d{V\}}|jr,|d}tj d|||||fS) Nrrrr4T)r rrr*z%r handled: (%r, %r)) rFr*r9r+rvrrwrrr)rrr0rtrrrrs rconnect_accepted_socketz%BaseEventLoop.connect_accepted_sockets! 9* * *J$JJKK K ,S ,CEE E +C +BDD D   d # # #$($E$E "C"7!5%F%7%7777777 8 ; L++H55D L/y( K K K(""r c K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz Read pipe %r connected: (%r, %r))rr-rrwrrfilenorrr,rrrs rconnect_read_pipezBaseEventLoop.connect_read_pipe2s##%%##%%2246JJ  LLLLLLLL  OO     ; = L; 8 = = =("" AAc K|}|}||||} |d{Vn#|xYw|jr)t jd|||||fS)Nz!Write pipe %r connected: (%r, %r))rr/rrwrrrqrrs rconnect_write_pipez BaseEventLoop.connect_write_pipeBs##%%##%%33D(FKK  LLLLLLLL  OO     ; = L< 8 = = =(""rtc|g}|%|dt||6|tjkr&|dt|nN|%|dt||%|dt|t jd|dS)Nzstdin=zstdout=stderr=zstdout=zstderr= )rAr&r"r$rrrg)rrr3r4r5rs r_log_subprocesszBaseEventLoop._log_subprocessRsu   KK6e!4!466 7 7 7  &J,="="= KK?f)=)=?? @ @ @ @! rUrfr4z+Object created at (most recent call last): z+Handle created at (most recent call last): r r\)getrF __traceback__rr sortedrg traceback format_listrstriprrArrF) rrrUrfr] log_linesr<valuetbs rdefault_exception_handlerz'BaseEventLoop.default_exception_handlers++i(( :9GKK ,,  YI4KLHHH g - -$0$61$6 & 'I '?? 0 0C...CLE(((WWY2599::F$***WWY2599::F$U    ..u.. / / / / TYYy))H======r c|jP ||dS#ttf$rt$rt jddYdSwxYw |||dS#ttf$rt$rc} |d||dn7#ttf$rt$rt jddYn wxYwYd}~dSYd}~dSd}~wwxYw)aDCall the current event loop's exception handler. The context argument is a dict containing the following keys: - 'message': Error message; - 'exception' (optional): Exception object; - 'future' (optional): Future instance; - 'task' (optional): Task instance; - 'handle' (optional): Handle instance; - 'protocol' (optional): Protocol instance; - 'transport' (optional): Transport instance; - 'socket' (optional): Socket instance; - 'asyncgen' (optional): Asynchronous generator that caused the exception. New keys maybe introduced in the future. Note: do not overload this method in an event loop subclass. For custom exception handling, use the `set_exception_handler()` method. Nz&Exception in default exception handlerTr\z$Unhandled error in exception handler)rUrfrzeException in default exception handler while handling an unexpected error in custom exception handler)rrrgrhr(rrF)rrrls rr\z$BaseEventLoop.call_exception_handlers,  " * ,..w77777 12     , , , E&*,,,,,,,  , 0''g66666 12     0 0 0022#I%(#*44 #$56$000L"?+/0000000000000 0sE 1AAA11C/ B'&C*'1CC*CC**C/cL|js|j|dSdS)zAdd a Handle to _ready.N) _cancelledrrArrs r _add_callbackzBaseEventLoop._add_callback&s3  ' K  v & & & & & ' 'r cX|||dS)z6Like _add_callback() but called from a signal handler.N)rr:rs r_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafe+s. 6""" r c8|jr|xjdz c_dSdS)z3Notification that a TimerHandle has been cancelled.rN)rrrs r_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled0s1   -  ' '1 , ' ' ' ' - -r ct|j}|tkrf|j|z tkrSg}|jD]&}|jrd|_||'tj|||_d|_nb|jr[|jdjrI|xjdzc_tj |j}d|_|jr|jdjId}|j s|j rd}nQ|jrJ|jdj }ttd||z t }|j|}||d}||jz}|jrZ|jd}|j |krnAtj |j}d|_|j ||jZt|j }t+|D]} |j }|jr#|jr ||_|} ||| z } | |jkr#t7jdt;|| d|_#d|_wxYw|d}dS)zRun one full iteration of the event loop. This calls all currently ready callbacks, polls for I/O, schedules the resulting callbacks, and finally schedules 'call_later' callbacks. FrrNzExecuting %s took %.3f seconds)rWr_MIN_SCHEDULED_TIMER_HANDLESr%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONrrArheapifyheappoprr_whenrmaxrMAXIMUM_SELECT_TIMEOUT _selectorselectr=rrangepopleftrwr_runrrrcr) r sched_count new_scheduledrtimeoutrr<end_timentodoirrs rr}zBaseEventLoop._run_once5s$/** 6 6 6  '+ 55 6 6M/ 1 1$1(-F%%!((0000 M- ( ( (+DO*+D ' '/ *doa&8&C *++q0++t77$)!/ *doa&8&C *  ; N$. NGG _ N?1%+D#a !3446LMMG^**733  Z((( 99;;!77o '_Q'F|x'']4?33F %F  K  v & & & o 'DK  u  A[((**F  {  0+1D(BKKMMMr)BT888'G'5f'='=rCCC,0D((4D(//// s A4K K ct|t|jkrdS|r7tj|_tjt jntj|j||_dSrO)rrrx#get_coroutine_origin_tracking_depthr#set_coroutine_origin_tracking_depthrDEBUG_STACK_DEPTHrenableds rrvz,BaseEventLoop._set_coroutine_origin_trackings ==D!HII I I F  =799  7  3+ - - - -  3; = = =3:///r c|jSrO)rwrs rrzBaseEventLoop.get_debugs {r cv||_|r||j|dSdSrO)rwrrCrvrs rrzBaseEventLoop.set_debugsG ??   T  % %d&I7 S S S S S T Tr rO)NNNr7)r)rN)FNN)Urrrrrrrrrrr&r)r-r/r8r:r=r r@rGrOr`rjrerrrrrjrrrKrLrrrrrrrrrrCrrrrrrrrrrrrr rrr-rSr*r9rrVr> AI_PASSIVErmrorsrvryr"r#rrrrrr\rrrr}rvrrrPr rrrs///<   ))))-d* % % %""""%)$""""" 9=" $t"&!%!% """""CG"""" @D(,"""" AE)-""""04"""" """"""777DDDGGG """2   DDDKKK4440$$$L***.%M ---   :>06:$26&%%%((("=A     555 *** 2"#!1HHHHH7777 A(, A A A A A...///4**.*.*.*.Z59G#14T"&!%!%$G#G#G#G#G#V*/"&!% ####8-<#'-<-<-<-<-<^111"""4%*(,.2-1 .+.+.+.+.+bEID#./q267;$ D#D#D#D#D#N'(f.@%&a D D D D D59|##"&!%|||||@"&!% #####<### ### % % %&0_&0o&0o27%)1(,T "#"#"#"#"#J%/OJO%/_$)1'+Dt # # # # #D''' ***"0>0>0>d707070r'''  --- NNN` : : :TTTTTr r)rr)r)6__doc__rTcollections.abcconcurrent.futuresrrrrYrBr*r@r"rcrrrxrKrrt ImportErrorr4rrrrrr r r r r rlogr__all__rrr)r@rrr&r1rLrcrmrqrvProtocolrxAbstractServerrAbstractEventLooprrPr rrsd      JJJJ CCC $ #),% GFJ ' ' #JJJ8888v,""" 76=!! GGGG    >>> A)A)A)A)A) 2A)A)A)HnnnnnV "nnnbXTXTXTXTXTF,XTXTXTXTXTsA AA