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KO}ӽmSşذqsOy?\[,d@'73'j%kOe`1.g2"e =YIzS2|zŐƄa\U,dP;jhhhaxǶ?КZ՚.q SE+XrbOu%\GتX(H,N^~]JyEZQKceTQ]VGYqnah;y$cQahT&QPZ*iZ8UQQM.qo/T\7X"u?Mttl2Xq(IoW{R^ ux*SYJ! 4S.Jy~ BROS[V|žKNɛP(L6V^|cR7i7nZW1Fd@ Ara{詑|(T*dN]Ko?s=@ |_EvF]׍kR)eBJc" MUUbY6`~V޴dJKß&~'d3i WWWWWW
Current Directory: /usr/lib64/python3.6/asyncio/__pycache__
Viewing File: /usr/lib64/python3.6/asyncio/__pycache__/base_events.cpython-36.pyc
3 \��@s�dZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZd gZd Zd ZeeefZ e!e d�Z"d)Z#dd�Z$dd�Z%dd�Z&dd�Z'dd�Z(dd�Z)de j*ddd�dd�Z+e!e d ��rRd!d"�Z,nd#d"�Z,d$d%�Z-Gd&d'�d'ej.�Z/Gd(d �d ej0�Z1dS)*a�Base 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�)�compat)� coroutines)�events)�futures)�tasks)� coroutine)�logger� BaseEventLoop�dg�?�AF_INET6�icCs0|j}tt|dd�tj�r$t|j�St|�SdS)N�__self__)Z _callback� isinstance�getattrr�Task�reprr�str)�handle�cb�r�#/usr/lib64/python3.6/base_events.py�_format_handle?s rcCs(|tjkrdS|tjkrdSt|�SdS)Nz<pipe>z<stdout>)� subprocess�PIPE�STDOUTr)�fdrrr� _format_pipeHs   rc CsLttd�std��n4y|jtjtjd�Wntk rFtd��YnXdS)N� SO_REUSEPORTz)reuse_port not supported by socket modulerzTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)�hasattr�socket� ValueError� setsockopt� SOL_SOCKETr�OSError)�sockrrr�_set_reuseportQs   r&cCs&ttd�r|d@tjkS|tjkSdS)N� SOCK_NONBLOCK�)rr � SOCK_STREAM)� sock_typerrr�_is_stream_socket\s r+cCs&ttd�r|d@tjkS|tjkSdS)Nr'r()rr � SOCK_DGRAM)r*rrr�_is_dgram_sockeths r-cCsvttd�sdS|dtjtjhks(|dkr,dSt|�r<tj}nt|�rLtj}ndS|dkr^d}nVt|t�rv|dkrvd}n>t|t�r�|dkr�d}n&y t |�}Wnt t fk r�dSX|tj kr�tj g}tr�|jtj�n|g}t|t�r�|jd�}d|k�rdSxp|D]h}yJtj||�t�r@|tjk�r@|||d||ddffS|||d||ffSWntk �rjYnX�qWdS)N� inet_ptonr��Zidna�%)rr � IPPROTO_TCPZ IPPROTO_UDPr+r-r�bytesr�int� TypeErrorr!� AF_UNSPEC�AF_INET� _HAS_IPv6�appendr �decoder.r$)�host�port�family�type�protoZafs�afrrr� _ipaddr_infopsL         rA)r=r>r?�flagsc CsZ|dd�\}}t|||||�}|dk r@|j�} | j|g�| S|j||||||d�SdS)N�)r=r>r?rB)rA� create_future� set_result� getaddrinfo) �addressr=r>r?rB�loopr;r<�info�futrrr�_ensure_resolved�s  rK� TCP_NODELAYcCs>|jtjtjhkr:t|j�r:|jtjkr:|jtjtj d�dS)Nr) r=r r7r r+r>r?r2r"rL)r%rrr� _set_nodelay�s  rMcCsdS)Nr)r%rrrrM�scCs.|j}t|t�r t|t� r dS|jj�dS)N)Z _exceptionr� BaseException� Exception�_loop�stop)rJ�excrrr�_run_until_complete_cb�s   rSc@sHeZdZdd�Zdd�Zdd�Zdd�Zd d �Zd d �Ze d d��Z dS)�ServercCs||_||_d|_g|_dS)Nr)rP�sockets� _active_count�_waiters)�selfrHrUrrr�__init__�szServer.__init__cCsd|jj|jfS)Nz<%s sockets=%r>)� __class__�__name__rU)rXrrr�__repr__�szServer.__repr__cCs |jdk st�|jd7_dS)Nr)rU�AssertionErrorrV)rXrrr�_attach�szServer._attachcCs<|jdkst�|jd8_|jdkr8|jdkr8|j�dS)Nrr)rVr]rU�_wakeup)rXrrr�_detach�szServer._detachcCsH|j}|dkrdSd|_x|D]}|jj|�qW|jdkrD|j�dS)Nr)rUrPZ _stop_servingrVr_)rXrUr%rrr�close�s  z Server.closecCs0|j}d|_x|D]}|j�s|j|�qWdS)N)rW�donerE)rX�waiters�waiterrrrr_�s  zServer._wakeupccs<|jdks|jdkrdS|jj�}|jj|�|EdHdS)N)rUrWrPrDr9)rXrdrrr� wait_closed�s   zServer.wait_closedN) r[� __module__� __qualname__rYr\r^r`rar_rrerrrrrT�s rTc @s�eZdZdd�Zdd�Zdd�Zdd�Zd d �Zd d �Zd�d d d�dd�Z d�dd d d d�dd�Z d�dd�Z d�dd�Z d�dd�Z ed�dd��Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zed'd(��Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zej�r�d3d4�Zd5d6�Zd7d8�Zd9d:�Z d;d<�Z!d=d>�Z"d?d@�Z#dAdB�Z$dCdD�Z%dEdF�Z&dGdH�Z'dIdJ�Z(dKdL�Z)dMdMdMdMdN�dOdP�Z*d�dQdR�Z+ed�d dMdMdMd d d dS�dTdU��Z,ed�dVdW��Z-ed�dMdMdMd d d d dX�dYdZ��Z.ed[d\��Z/ed�e0j1e0j2d d]d d d d^�d_d`��Z3ed da�dbdc��Z4eddde��Z5edfdg��Z6dhdi�Z7ee8j9e8j9e8j9ddjdMdk�dldm��Z:ee8j9e8j9e8j9dddMdk�dndo��Z;dpdq�Z<drds�Z=dtdu�Z>dvdw�Z?dxdy�Z@dzd{�ZAd|d}�ZBd~d�ZCd�d��ZDd�d��ZEd�d��ZFd S)�r cCs�d|_d|_d|_tj�|_g|_d|_d|_d|_ t j d�j |_ d|_|jtjj odttjjd���d|_d|_d|_d|_ttd�r�tj�|_nd|_d|_dS)NrF� monotonicZPYTHONASYNCIODEBUGg�������?�get_asyncgen_hooks) �_timer_cancelled_count�_closed� _stopping� collections�deque�_ready� _scheduled�_default_executorZ _internal_fds� _thread_id�timeZget_clock_infoZ resolution�_clock_resolution�_exception_handler� set_debug�sysrB�ignore_environment�bool�os�environ�get�slow_callback_duration�_current_handle� _task_factory�_coroutine_wrapper_setr�weakref�WeakSet� _asyncgens�_asyncgens_shutdown_called)rXrrrrY�s(   zBaseEventLoop.__init__cCs d|jj|j�|j�|j�fS)Nz"<%s running=%s closed=%s debug=%s>)rZr[� is_running� is_closed� get_debug)rXrrrr\ s zBaseEventLoop.__repr__cCs tj|d�S)z,Create a Future object attached to the loop.)rH)rZFuture)rXrrrrD%szBaseEventLoop.create_futurecCs@|j�|jdkr0tj||d�}|jr<|jd=n |j||�}|S)zDSchedule a coroutine object. Return a task object. N)rHr���)� _check_closedrrr�_source_traceback)rX�coroZtaskrrr� create_task)s   zBaseEventLoop.create_taskcCs$|dk rt|� rtd��||_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)�callabler5r)rX�factoryrrr�set_task_factory7s zBaseEventLoop.set_task_factorycCs|jS)z<Return a task factory, or None if the default one is in use.)r)rXrrr�get_task_factoryEszBaseEventLoop.get_task_factoryN)�extra�servercCst�dS)zCreate socket transport.N)�NotImplementedError)rXr%�protocolrdr�r�rrr�_make_socket_transportIsz$BaseEventLoop._make_socket_transportF)� server_side�server_hostnamer�r�c Cst�dS)zCreate SSL transport.N)r�) rXZrawsockr�� sslcontextrdr�r�r�r�rrr�_make_ssl_transportNsz!BaseEventLoop._make_ssl_transportcCst�dS)zCreate datagram transport.N)r�)rXr%r�rGrdr�rrr�_make_datagram_transportTsz&BaseEventLoop._make_datagram_transportcCst�dS)zCreate read pipe transport.N)r�)rX�piper�rdr�rrr�_make_read_pipe_transportYsz'BaseEventLoop._make_read_pipe_transportcCst�dS)zCreate write pipe transport.N)r�)rXr�r�rdr�rrr�_make_write_pipe_transport^sz(BaseEventLoop._make_write_pipe_transportc Kst�dS)zCreate subprocess transport.N)r�) rXr��args�shell�stdin�stdout�stderr�bufsizer��kwargsrrr�_make_subprocess_transportcsz(BaseEventLoop._make_subprocess_transportcCst�dS)z�Write a byte to self-pipe, to wake up the event loop. This may be called from a different thread. The subclass is responsible for implementing the self-pipe. N)r�)rXrrr�_write_to_selfjszBaseEventLoop._write_to_selfcCst�dS)zProcess selector events.N)r�)rX� event_listrrr�_process_eventssszBaseEventLoop._process_eventscCs|jrtd��dS)NzEvent loop is closed)rk� RuntimeError)rXrrrr�wszBaseEventLoop._check_closedcCs*|jj|�|j�s&|j|j|j��dS)N)r��discardr��call_soon_threadsafer��aclose)rX�agenrrr�_asyncgen_finalizer_hook{s z&BaseEventLoop._asyncgen_finalizer_hookcCs,|jrtjdj|�t|d�|jj|�dS)NzNasynchronous generator {!r} was scheduled after loop.shutdown_asyncgens() call)�source)r��warnings�warn�format�ResourceWarningr��add)rXr�rrr�_asyncgen_firstiter_hook�s  z&BaseEventLoop._asyncgen_firstiter_hookccs�d|_|jdkst|j� r dSt|j�}|jj�tjdd�|D�d|d��}|EdH}x8t||�D]*\}}t|t �rf|j dj |�||d��qfWdS)z,Shutdown all active asynchronous generators.TNcSsg|] }|j��qSr)r�)�.0Zagrrr� <listcomp>�sz4BaseEventLoop.shutdown_asyncgens.<locals>.<listcomp>)Zreturn_exceptionsrHz?an error occurred during closing of asynchronous generator {!r})�message� exceptionZasyncgen) r�r��len�list�clearr�gather�ziprrO�call_exception_handlerr�)rXZ closing_agensZ shutdown_coro�results�resultr�rrr�shutdown_asyncgens�s"      z BaseEventLoop.shutdown_asyncgensc Cs�|j�|j�rtd��tj�dk r,td��|j|j�tj�|_ |j dk rft j �}t j |j|jd�z$tj|�x|j�|jrtPqtWWdd|_d|_ tjd�|jd�|j dk r�t j |�XdS)zRun until stop() is called.z"This event loop is already runningNz7Cannot run the event loop while another loop is running)� firstiter� finalizerF)r�r�r�rZ_get_running_loop�_set_coroutine_wrapper�_debug� threading� get_identrrr�rwri�set_asyncgen_hooksr�r�Z_set_running_loop� _run_oncerl)rXZold_agen_hooksrrr� run_forever�s0          zBaseEventLoop.run_forevercCs�|j�tj|� }tj||d�}|r,d|_|jt�z>y |j�Wn,|rj|j �rj|j � rj|j ��YnXWd|j t�X|j �s�t d��|j�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. )rHFNz+Event loop stopped before Future completed.)r�rZisfuturerZ ensure_futureZ_log_destroy_pendingZadd_done_callbackrSr�rbZ cancelledr�Zremove_done_callbackr�r�)rXZfutureZnew_taskrrr�run_until_complete�s      z BaseEventLoop.run_until_completecCs d|_dS)z�Stop running the event loop. Every callback already scheduled will still run. This simply informs run_forever to stop looping after a complete iteration. TN)rl)rXrrrrQ�szBaseEventLoop.stopcCsj|j�rtd��|jrdS|jr,tjd|�d|_|jj�|jj�|j }|dk rfd|_ |j dd�dS)z�Close 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 %rTF)�wait) r�r�rkr�r �debugror�rprqZshutdown)rX�executorrrrra�s   zBaseEventLoop.closecCs|jS)z*Returns True if the event loop was closed.)rk)rXrrrr�szBaseEventLoop.is_closedcCs0|j�s,tjd|t|d�|j�s,|j�dS)Nzunclosed event loop %r)r�)r�r�r�r�r�ra)rXrrr�__del__ s  zBaseEventLoop.__del__cCs |jdk S)z*Returns True if the event loop is running.N)rr)rXrrrr�szBaseEventLoop.is_runningcCstj�S)z�Return 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. )rsrh)rXrrrrsszBaseEventLoop.timecGs,|j|j�||f|��}|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. rr�)�call_atrsr�)rXZdelay�callbackr��timerrrr� call_later szBaseEventLoop.call_latercGsX|j�|jr"|j�|j|d�tj||||�}|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. r�rTr�) r�r�� _check_thread�_check_callbackr� TimerHandler��heapq�heappushrp)rX�whenr�r�r�rrrr�5s zBaseEventLoop.call_atcGs@|j�|jr"|j�|j|d�|j||�}|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_soonrr�)r�r�r�r�� _call_soonr�)rXr�r�rrrrr�Es   zBaseEventLoop.call_sooncCs>tj|�stj|�r"tdj|���t|�s:tdj||���dS)Nz#coroutines cannot be used with {}()z0a callable object was expected by {}(), got {!r})rZ iscoroutineZiscoroutinefunctionr5r�r�)rXr��methodrrrr�Xs   zBaseEventLoop._check_callbackcCs,tj|||�}|jr|jd=|jj|�|S)Nrr�)r�Handler�ror9)rXr�r�rrrrr�cs  zBaseEventLoop._call_sooncCs,|jdkrdStj�}||jkr(td��dS)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)rrr�r�r�)rXZ thread_idrrrr�js  zBaseEventLoop._check_threadcGs@|j�|jr|j|d�|j||�}|jr4|jd=|j�|S)z"Like call_soon(), but thread-safe.r�rr�)r�r�r�r�r�r�)rXr�r�rrrrr�{s  z"BaseEventLoop.call_soon_threadsafecGsZ|j�|jr|j|d�|dkr@|j}|dkr@tjj�}||_tj|j|f|��|d�S)N�run_in_executor)rH) r�r�r�rq� concurrentrZThreadPoolExecutorZ wrap_futureZsubmit)rXr��funcr�rrrr��s  zBaseEventLoop.run_in_executorcCs ||_dS)N)rq)rXr�rrr�set_default_executor�sz"BaseEventLoop.set_default_executorc Cs�d||fg}|r |jd|�|r2|jd|�|rD|jd|�|rV|jd|�dj|�}tjd|�|j�}tj||||||�} |j�|} d|| d | f}| |jkr�tj|�n tj|�| S) Nz%s:%rz family=%rztype=%rzproto=%rzflags=%rz, zGet address info %sz(Getting address info %s took %.3f ms: %rg@�@) r9�joinr r�rsr rFr}rI) rXr;r<r=r>r?rB�msg�t0Zaddrinfo�dtrrr�_getaddrinfo_debug�s(      z BaseEventLoop._getaddrinfo_debugr)r=r>r?rBc Cs>|jr |jd|j||||||�S|jdtj||||||�SdS)N)r�r�r�r rF)rXr;r<r=r>r?rBrrrrF�s   zBaseEventLoop.getaddrinfocCs|jdtj||�S)N)r�r � getnameinfo)rXZsockaddrrBrrrr��szBaseEventLoop.getnameinfo)�sslr=r?rBr%� local_addrr�c#s| dk r| rtd��| dkr2|r2|s.td��|} |dk sD|dk �r�|dk rTtd��t||f|tj|||d�} | g} | dk r�t| |tj|||d�} | j| �nd} tj| |d�EdH| j�}|s�td��| dk r�| j�}|s�td��g}�x�|D�]B\}}}}}y�tj|||d�}|j d �| dk �r�x�|D]j\}}}}}y|j |�PWnHtk �r�}z*t|j d j ||j j���}|j|�WYdd}~XnX�q.W|j�d}w�|j�r�tjd ||�|j||�EdHWn^tk �r}z"|dk �r�|j�|j|�WYdd}~Xq�|dk �r,|j��Yq�XPq�Wt|�d k�rR|d �nJt|d ��t�fdd�|D���r~|d �tdj djdd�|D�����n,|dk�r�td��t|j��s�tdj |���|j|||| �EdH\}}|j�r |jd�}tjd|||||�||fS)a�Connect 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 hostz8host/port and sock can not be specified at the same time)r=r>r?rBrH)rHz!getaddrinfo() returned empty list)r=r>r?Fz2error while attempting to bind on address {!r}: {}zconnect %r to %rrrc3s|]}t|��kVqdS)N)r)r�rR)�modelrr� <genexpr>sz2BaseEventLoop.create_connection.<locals>.<genexpr>zMultiple exceptions: {}z, css|]}t|�VqdS)N)r)r�rRrrrr�#sz5host and port was not specified and no sock specifiedz&A Stream Socket was expected, got {!r}r z%r connected to %s:%r: (%r, %r))r!rKr r)r9rr�r�r$� setblocking�bind�errnor��strerror�lowerrar�r r�� sock_connectr�r�allr�r+r>�_create_connection_transport�get_extra_info)rX�protocol_factoryr;r<r�r=r?rBr%r�r��f1�fs�f2�infosZ laddr_infos� exceptionsr>ZcnamerG�_ZladdrrR� transportr�r)r�r�create_connection�s�        "        zBaseEventLoop.create_connectionc cs�|jd�|�}|j�}|rFt|t�r*dn|}|j||||||d�} n|j|||�} y|EdHWn| j��YnX| |fS)NF)r�r�)r�rDrryr�r�ra) rXr%r�r�r�r�r�rdr�r�rrrr�=s  z*BaseEventLoop._create_connection_transport)r=r?rB� reuse_address� reuse_port�allow_broadcastr%c#sZ| dk r�t| j�s tdj| ����s@�s@|s@|s@|s@|s@|s@| r~t��|||||| d�} djdd�| j�D��} tdj| ���| jd�d} �nL�p��s�|d kr�td ��||fdff}n�tj �}x�d �fd �ffD]�\}}|dk r�t |t ��r�t |�d k�st d ��t||tj|||d�EdH}|�s.td��xB|D]:\}}}}}||f}||k�r`ddg||<||||<�q4Wq�W��fdd�|j�D�}|�s�td��g}|dk�r�tjdk�o�tjdk}�x|D�]\\}}\}}d} d} y�tj|tj|d�} |�r| jtjtjd �|�rt| �| �r4| jtjtjd �| jd���rN| j|���rj|j| |�EdH|} Wn^tk �r�}z"| dk �r�| j�|j|�WYdd}~Xn"| dk �r�| j��YnXP�q�W|d �|�}|j�}|j | || |�}|j!�r,��rt"j#d��||�nt"j$d�||�y|EdHWn|j��YnX||fS)zCreate datagram connection.Nz#A UDP Socket was expected, got {!r})r�� remote_addrr=r?rBr�rrz, css"|]\}}|rdj||�VqdS)z{}={}N)r�)r��k�vrrrr�isz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>zNsocket modifier keyword arguments can not be used when sock is specified. ({})Frzunexpected address familyrrCz2-tuple is expected)r=r>r?rBrHz!getaddrinfo() returned empty listcs8g|]0\}}�r|ddkp*�o*|ddks||f�qS)rNrr)r��keyZ addr_pair)r�rrrr��sz:BaseEventLoop.create_datagram_endpoint.<locals>.<listcomp>zcan not get address information�posix�cygwin)r=r>r?z@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))NN)%r-r>r!r��dictr��itemsr�rm� OrderedDictr�tupler�r]rKr r,r$rz�namerw�platformr"r#� SO_REUSEADDRr&Z SO_BROADCASTr�r�rar9rDr�r�r rIr�)rXr�r�rr=r?rBr�rrr%ZoptsZproblemsZr_addrZaddr_pairs_infoZ addr_infos�idxZaddrr�Zfamr�ZprorGrr�Z local_addressZremote_addressrRr�rdr�r)r�rr�create_datagram_endpointUs�              z&BaseEventLoop.create_datagram_endpointccs4t||f|tj||d�EdH}|s0tdj|���|S)N)r=r>rBrHz%getaddrinfo({!r}) returned empty list)rKr r)r$r�)rXr;r<r=rBr�rrr�_create_server_getaddrinfo�s  z(BaseEventLoop._create_server_getaddrinfor )r=rBr%�backlogr�r�rc #s�t|t�rtd��|dk s$�dk �r|dk r4td��| dkrPtjdkoNtjdk} g} |dkrddg} n$t|t�s|t|t j � r�|g} n|} ����fdd�| D�} t j | d �i�EdH}t tjj|��}d }�z �x|D�] }|\}}}}}ytj|||�}Wn6tjk �r2�j�r,tjd |||d d �w�YnX| j|�| �rV|jtjtjd �| �rdt|�t�r�|tjk�r�ttd��r�|jtjtjd �y|j |�Wq�t!k �r�}z t!|j"d||j#j$�f��WYdd}~Xq�Xq�Wd }Wd|�s x| D]}|j%��q�WXn2|dk�r"td��t&|j'��s<tdj(|���|g} t)�| �}x4| D],}|j*|�|j+d ��j,|||||��qRW�j�r�tj-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 NoneNz8host/port and sock can not be specified at the same timerrr0csg|]}�j|���d��qS))r=rB)r)r�r;)r=rBr<rXrrr�sz/BaseEventLoop.create_server.<locals>.<listcomp>rHFz:create_server() failed to create socket.socket(%r, %r, %r)T)�exc_info� IPPROTO_IPV6z0error while attempting to bind on address %r: %sz)Neither host/port nor sock were specifiedz&A Stream Socket was expected, got {!r}z %r is serving).rryr5r!rzr rwr rrm�Iterablerr��set� itertools�chain� from_iterabler �errorr�r �warningr9r"r#rr&r8r rrZ IPV6_V6ONLYr�r$r�r�r�rar+r>r�rTZlistenr�Z_start_servingrI)rXr�r;r<r=rBr%rr�r�rrUZhostsr�r�Z completed�resr@Zsocktyper?Z canonnameZsa�errr�r)r=rBr<rXr� create_server�s�     (         zBaseEventLoop.create_server)r�ccs^t|j�stdj|���|j|||ddd�EdH\}}|jrV|jd�}tjd|||�||fS)aHandle an accepted connection. This is used by servers that accept connections outside of asyncio but that use asyncio to handle connections. This method is a coroutine. When completed, the coroutine returns a (transport, protocol) pair. z&A Stream Socket was expected, got {!r}r0T)r�Nr z%r handled: (%r, %r)) r+r>r!r�r�r�r�r r�)rXr�r%r�r�r�rrr�connect_accepted_socketAs   z%BaseEventLoop.connect_accepted_socketc csd|�}|j�}|j|||�}y|EdHWn|j��YnX|jr\tjd|j�||�||fS)Nz Read pipe %r connected: (%r, %r))rDr�rar�r r��fileno)rXr�r�r�rdr�rrr�connect_read_pipeXszBaseEventLoop.connect_read_pipec csd|�}|j�}|j|||�}y|EdHWn|j��YnX|jr\tjd|j�||�||fS)Nz!Write pipe %r connected: (%r, %r))rDr�rar�r r�r )rXr�r�r�rdr�rrr�connect_write_pipeisz BaseEventLoop.connect_write_pipecCs�|g}|dk r |jdt|��|dk rF|tjkrF|jdt|��n4|dk r`|jdt|��|dk rz|jdt|��tjdj|��dS)Nzstdin=%szstdout=stderr=%sz stdout=%sz stderr=%s� )r9rrrr r�r�)rXr�r�r�r�rIrrr�_log_subprocesszszBaseEventLoop._log_subprocessT)r�r�r��universal_newlinesr�r�c ks�t|ttf�std��|r"td��|s.td��|dkr>td��|�} d} |jrfd|} |j| |||�|j| |d||||f| �EdH} |jr�| dk r�tjd| | �| | fS) Nzcmd must be a stringz universal_newlines must be Falsezshell must be Truerzbufsize must be 0zrun shell command %rTz%s: %r) rr3rr!r�r$r�r rI) rXr��cmdr�r�r�r%r�r�r�r�� debug_logr�rrr�subprocess_shell�s$zBaseEventLoop.subprocess_shellcos�|r td��|rtd��|dkr(td��|f| } x,| D]$} t| ttf�s8tdt| �j��q8W|�} d}|jr�d|}|j||||�|j | | d||||f| �EdH}|jr�|dk r�t j d||�|| fS) Nz universal_newlines must be Falsezshell must be Falserzbufsize must be 0z8program arguments must be a bytes or text string, not %szexecute program %rFz%s: %r) r!rrr3r5r>r[r�r$r�r rI)rXr�Zprogramr�r�r�r%r�r�r�r�Z popen_args�argr�r'r�rrr�subprocess_exec�s,   zBaseEventLoop.subprocess_execcCs|jS)zKReturn an exception handler, or None if the default one is in use. )ru)rXrrr�get_exception_handler�sz#BaseEventLoop.get_exception_handlercCs*|dk r t|� r tdj|���||_dS)a�Set handler as the new event loop exception handler. If handler is None, the default exception handler will be set. If handler is a callable object, it should have a signature matching '(loop, context)', where 'loop' will be a reference to the active event loop, 'context' will be a dict object (see `call_exception_handler()` documentation for details about context). Nz/A callable object or None is expected, got {!r})r�r5r�ru)rXZhandlerrrr�set_exception_handler�s z#BaseEventLoop.set_exception_handlerc Cs|jd�}|sd}|jd�}|dk r6t|�||jf}nd}d|kr`|jdk r`|jjr`|jj|d<|g}x�t|�D]�}|dkr~qp||}|dkr�djtj|��}d }||j �7}n2|dkr�djtj|��}d }||j �7}nt |�}|j d j ||��qpWt jd j|�|d �dS)aEDefault exception handler. This is called when an exception occurs and no exception handler is set, and can be called by a custom exception handler that wants to defer to the default behavior. This default handler logs the error message and other context-dependent information. In debug mode, a truncated stack trace is also appended showing where the given object (e.g. a handle or future or task) was created, if any. The context parameter has the same meaning as in `call_exception_handler()`. r�z!Unhandled exception in event loopr�NFZsource_tracebackZhandle_tracebackr0z+Object created at (most recent call last): z+Handle created at (most recent call last): z{}: {}� )r>r�r�)r|r>� __traceback__r~r��sortedr�� traceback� format_list�rstriprr9r�r r) rX�contextr�r�rZ log_linesr�value�tbrrr�default_exception_handler�s6    z'BaseEventLoop.default_exception_handlercCs�|jdkr>y|j|�Wq�tk r:tjddd�Yq�Xnny|j||�Wn\tk r�}z@y|jd||d��Wn"tk r�tjddd�YnXWYdd}~XnXdS)aCall 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; - '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 handlerT)rz$Unhandled error in exception handler)r�r�r3zeException in default exception handler while handling an unexpected error in custom exception handler)rur6rOr r)rXr3rRrrrr�s" z$BaseEventLoop.call_exception_handlercCs@t|tj�std��|jrdSt|tj� s0t�|jj|�dS)z3Add a Handle to _scheduled (TimerHandle) or _ready.zA Handle is required hereN)rrr�r]� _cancelledr�ror9)rXrrrr� _add_callback9s zBaseEventLoop._add_callbackcCs|j|�|j�dS)z6Like _add_callback() but called from a signal handler.N)r8r�)rXrrrr�_add_callback_signalsafeAs z&BaseEventLoop._add_callback_signalsafecCs|jr|jd7_dS)z3Notification that a TimerHandle has been cancelled.rN)rprj)rXrrrr�_timer_handle_cancelledFsz%BaseEventLoop._timer_handle_cancelledc Cs�t|j�}|tkrd|j|tkrdg}x&|jD]}|jr>d|_q,|j|�q,Wtj|�||_d|_n8x6|jr�|jdjr�|jd8_tj |j�}d|_qfWd}|j s�|j r�d}n*|jr�|jdj }t td||j��t�}|jo�|dk�r�|j�}|jj|�}|j�|}|dk�rtj} ntj} t|�} |dk�rLtj| d|d| �nD| �rntj| d|d|d| �n"|dk�r�tj| d |d|d�n |jj|�}|j|�|j�|j} xD|j�r�|jd}|j | k�r�Ptj |j�}d|_|j j|��q�Wt|j �} x�t| �D]|} |j j�}|j�r*�q|j�r�zD||_|j�}|j�|j�|}||jk�rttj d t!|�|�Wdd|_Xn|j��qWd}dS) z�Run 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. FrrNg�?zpoll took %.3f ms: %s eventsg@�@z$poll %.3f ms took %.3f ms: %s eventsz"poll %.3f ms took %.3f ms: timeoutzExecuting %s took %.3f seconds)"r�rp�_MIN_SCHEDULED_TIMER_HANDLESrj�%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr7r9r��heapify�heappoprorlZ_when�min�maxrs�MAXIMUM_SELECT_TIMEOUTr�Z _selectorZselect�logging�INFO�DEBUGr �logr�rt�range�popleftr~Z_runr}rr)rXZ sched_countZ new_scheduledrZtimeoutr�r�r�r��levelZneventZend_timeZntodo�irrrr�Ks�                       zBaseEventLoop._run_oncec Cs�ytj}tj}Wntk r$dSXt|�}|j|kr<dStj}|�}|rz|d|fkrjtj d|t �q�||�d|_n,|d|fkr�tj d|t �n|d�d|_dS)Nz[loop.set_debug(True): cannot set debug coroutine wrapper; another wrapper is already set %rTzWloop.set_debug(False): cannot unset debug coroutine wrapper; another wrapper was set %rF) rw�set_coroutine_wrapper�get_coroutine_wrapper�AttributeErrorryr�rZ debug_wrapperr�r��RuntimeWarning)rX�enabledZ set_wrapperZ get_wrapper�wrapperZcurrent_wrapperrrrr��s.      z$BaseEventLoop._set_coroutine_wrappercCs|jS)N)r�)rXrrrr��szBaseEventLoop.get_debugcCs||_|j�r|j|�dS)N)r�r�r�)rXrNrrrrv�szBaseEventLoop.set_debug)N)N)NNN)NN)NN)N)r)NN)F)NN)NN)Gr[rfrgrYr\rDr�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�rQrar�rZPY34r�r�rsr�r�r�r�r�r�r�r�r�r�rFr�r�r�rrr r6Z AI_PASSIVErrr!r"r$rrr(r*r+r,r6r�r8r9r:r�r�r�rvrrrrr �s�!      %       u `   12c!i�Q)2�__doc__rm�concurrent.futuresr�r��inspectrrBrzr rr�rsr0rwr�r�r0rrrrrrrEr �__all__r;r<�BrokenPipeError�ConnectionResetError�ConnectionAbortedErrorZ_FATAL_ERROR_IGNORErr8rArrr&r+r-rAr)rKrMrSZAbstractServerrTZAbstractEventLoopr rrrr�<module>sV            ;   /