관리-도구
편집 파일: base_events.cpython-39.opt-2.pyc
a �����DOg�!���������������������@���s���d�dl�Z�d�dlZ�d�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z d�dlZd�dlZd�dl Z d�dlZd�dlZd�dlZzd�dlZW�n�ey����dZY�n0�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�ddlmZ�dd lmZ�dd lmZ�ddlmZ�ddlmZ�dd lmZ�ddlm Z �dZ!dZ"dZ#e$ed�Z%dZ&e'��Z(dd��Z)dd��Z*dd��Z+d,dd�Z,d-dd�Z-dd��Z.e$ed ��r�d!d"��Z/nd#d"��Z/d$d%��Z0G�d&d'��d'ej1�Z2G�d(d)��d)ej3�Z4G�d*d+��d+ej5�Z6dS�).�����N����)� constants)� coroutines)�events)� exceptions)�futures)� protocols)�sslproto)� staggered)�tasks)� transports)�trsock)�logger)� BaseEventLoop�Server�d���g�������?�AF_INET6i�Q�c�����������������C���s0���|�j�}tt|dd��tj�r$t|j�S�t|��S�d�S�)N�__self__)� _callback� isinstance�getattrr����Task�reprr����str)�handle�cb��r����+/usr/lib64/python3.9/asyncio/base_events.py�_format_handleJ���s���� r���c�����������������C���s(���|�t�jkrdS�|�t�jkrdS�t|��S�d�S�)Nz<pipe>z<stdout>)� subprocess�PIPE�STDOUTr���)�fdr���r���r����_format_pipeS���s ���� r#���c�����������������C���sJ���t�td�std��n2z|��tjtjd��W�n�tyD���td��Y�n0�d�S�)N�SO_REUSEPORTz)reuse_port not supported by socket moduler���zTreuse_port not supported by socket module, SO_REUSEPORT defined but not implemented.)�hasattr�socket� ValueError� setsockopt� SOL_SOCKETr$����OSError��sockr���r���r����_set_reuseport\���s���� r-���c����������� ��� ���C���s���t�td�sd�S�|dtjtjhvs(|�d�u�r,d�S�|tjkr>tj}n|tjkrPtj}nd�S�|d�u�rbd}nVt|t�rz|dkrzd}n>t|t�r�|dkr�d}n&zt |�}W�n�t tfy����Y�d�S�0�|tjkr�tj g}tr�|�tj��n|g}t|�t�r�|��d�}�d|�v��rd�S�|D�]r}zVt�||���t�rH|tjk�rH|||d|�|||ffW���S�|||d|�|ffW���S�W�n�t�yv���Y�n0��qd�S�)N� inet_ptonr����������Zidna�%)r%���r&����IPPROTO_TCP�IPPROTO_UDP�SOCK_STREAM� SOCK_DGRAMr����bytesr����int� TypeErrorr'���� AF_UNSPEC�AF_INET� _HAS_IPv6�appendr����decoder.���r*���) �host�port�family�type�protoZflowinfoZscopeidZafs�afr���r���r����_ipaddr_infog���sN���� � rD���c�����������������C���s����t����}|�D�]*}|d�}||vr(g�||<�||��|��qt|����}g�}|dkr||�|d�d�|d�����|d�d�|d��=�|�dd��tj�tj |���D����|S�)Nr���r���c�����������������s���s���|�]}|d�ur|V��qd�S��Nr���)�.0�ar���r���r���� <genexpr>����s����z(_interleave_addrinfos.<locals>.<genexpr>) �collections�OrderedDictr<����list�values�extend� itertools�chain� from_iterable�zip_longest)Z addrinfosZfirst_address_family_countZaddrinfos_by_family�addrr@���Zaddrinfos_listsZ reorderedr���r���r����_interleave_addrinfos����s"���� ��rS���c�����������������C���s4���|�����s"|����}t|ttf�r"d�S�t�|������d�S�rE���)� cancelled� exceptionr���� SystemExit�KeyboardInterruptr���Z _get_loop�stop)�fut�excr���r���r����_run_until_complete_cb����s ����r[����TCP_NODELAYc�����������������C���s@���|�j�tjtjhv�r<|�jtjkr<|�jtjkr<|��tjtj d��d�S��Nr���) r@���r&���r:���r���rA���r4���rB���r2���r(���r\���r+���r���r���r����_set_nodelay����s���� � �r^���c�����������������C���s���d�S�rE���r���r+���r���r���r���r^�������s����c�����������������C���s ���t�d�urt|�t�j�rtd��d�S�)Nz"Socket cannot be of type SSLSocket)�sslr���Z SSLSocketr8���r+���r���r���r����_check_ssl_socket����s����r`���c�������������������@���sT���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z dd��ZdS�)�_SendfileFallbackProtocolc�����������������C���sh���t�|tj�std��||�_|���|�_|���|�_|j |�_ |����|�|���|�j r^|�jj ���|�_nd�|�_d�S�)Nz.transport should be _FlowControlMixin instance)r���r���Z_FlowControlMixinr8���� _transportZget_protocol�_protoZ is_reading�_should_resume_readingZ_protocol_paused�_should_resume_writing� pause_reading�set_protocol�_loop� create_future�_write_ready_fut)�self�transpr���r���r����__init__����s���� z"_SendfileFallbackProtocol.__init__c���������������������s2���|�j����rtd��|�j}|d�u�r$d�S�|I�d�H��d�S�)NzConnection closed by peer)rb���� is_closing�ConnectionErrorrj���)rk���rY���r���r���r����drain����s���� z_SendfileFallbackProtocol.drainc�����������������C���s���t�d��d�S�)Nz?Invalid state: connection should have been established already.��RuntimeError)rk���� transportr���r���r����connection_made����s����z)_SendfileFallbackProtocol.connection_madec�����������������C���s@���|�j�d�ur0|d�u�r$|�j��td���n|�j��|��|�j�|��d�S�)NzConnection is closed by peer)rj���� set_exceptionro���rc����connection_lost)rk���rZ���r���r���r���rv�������s���� �z)_SendfileFallbackProtocol.connection_lostc�����������������C���s ���|�j�d�urd�S�|�jj���|�_�d�S�rE���)rj���rb���rh���ri����rk���r���r���r���� pause_writing����s���� z'_SendfileFallbackProtocol.pause_writingc�����������������C���s$���|�j�d�u�rd�S�|�j��d��d�|�_�d�S�)NF)rj���� set_resultrw���r���r���r����resume_writing����s���� z(_SendfileFallbackProtocol.resume_writingc�����������������C���s���t�d��d�S��Nz'Invalid state: reading should be pausedrq���)rk����datar���r���r���� data_received��s����z'_SendfileFallbackProtocol.data_receivedc�����������������C���s���t�d��d�S�r{���rq���rw���r���r���r����eof_received��s����z&_SendfileFallbackProtocol.eof_receivedc���������������������sF���|�j��|�j��|�jr|�j�����|�jd�ur2|�j����|�jrB|�j����d�S�rE���) rb���rg���rc���rd����resume_readingrj����cancelre���rz���rw���r���r���r����restore ��s���� z!_SendfileFallbackProtocol.restoreN)�__name__� __module__�__qualname__rm���rp���rt���rv���rx���rz���r}���r~���r����r���r���r���r���ra�������s���ra���c�������������������@���sx���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z edd���Zdd��Z dd��Zdd��Zdd��ZdS�)r���c�����������������C���s@���||�_�||�_d|�_g�|�_||�_||�_||�_||�_d|�_d�|�_ d�S�)Nr���F) rh����_sockets� _active_count�_waiters�_protocol_factory�_backlog�_ssl_context�_ssl_handshake_timeout�_serving�_serving_forever_fut)rk����loop�sockets�protocol_factoryZssl_context�backlog�ssl_handshake_timeoutr���r���r���rm�����s����zServer.__init__c�����������������C���s���d|�j�j��d|�j�d�S�)N�<z sockets=�>)� __class__r����r����rw���r���r���r����__repr__%��s����zServer.__repr__c�����������������C���s���|��j�d7��_�d�S�r]���)r����rw���r���r���r����_attach(��s����zServer._attachc�����������������C���s.���|��j�d8��_�|�j�dkr*|�jd�u�r*|�����d�S�)Nr���r���)r����r�����_wakeuprw���r���r���r����_detach,��s����zServer._detachc�����������������C���s,���|�j�}d�|�_�|D�]}|���s|�|��qd�S�rE���)r�����donery���)rk����waiters�waiterr���r���r���r����2��s ����zServer._wakeupc�������������� ���C���sJ���|�j�r d�S�d|�_�|�jD�].}|�|�j��|�j�|�j||�j|�|�j|�j��qd�S��NT) r����r�����listenr����rh����_start_servingr����r����r����)rk���r,���r���r���r���r����9��s���� �zServer._start_servingc�����������������C���s���|�j�S�rE���)rh���rw���r���r���r����get_loopC��s����zServer.get_loopc�����������������C���s���|�j�S�rE���)r����rw���r���r���r���� is_servingF��s����zServer.is_servingc�����������������C���s"���|�j�d�u�rdS�tdd��|�j�D���S�)Nr���c�����������������s���s���|�]}t��|�V��qd�S�rE���)r ���ZTransportSocket)rF����sr���r���r���rH���M��r/���z!Server.sockets.<locals>.<genexpr>)r�����tuplerw���r���r���r���r����I��s���� zServer.socketsc�����������������C���sn���|�j�}|d�u�rd�S�d�|�_�|D�]}|�j�|��qd|�_|�jd�urX|�j���sX|�j����d�|�_|�jdkrj|�����d�S�)NFr���) r����rh���Z _stop_servingr����r����r����r����r����r����)rk���r����r,���r���r���r����closeO��s���� � zServer.closec���������������������s���|������t�d�I�d�H��d�S�)Nr���)r����r����sleeprw���r���r���r���� start_servingb��s����zServer.start_servingc�������������� �������s����|�j�d�urtd|��d���|�jd�u�r4td|��d���|�����|�j���|�_�zRz|�j�I�d�H��W�n6�tjy����z|�����|�� ��I�d�H��W���n��0�Y�n0�W�d�|�_�nd�|�_�0�d�S�)Nzserver z, is already being awaited on serve_forever()z is closed) r����rr���r����r����rh���ri���r����CancelledErrorr�����wait_closedrw���r���r���r���� serve_foreverh��s ���� � zServer.serve_foreverc���������������������s<���|�j�d�u�s|�jd�u�rd�S�|�j���}|�j�|��|I�d�H��d�S�rE���)r����r����rh���ri���r<���)rk���r����r���r���r���r����}��s ���� zServer.wait_closedN)r����r����r����rm���r����r����r����r����r����r����r�����propertyr����r����r����r����r����r���r���r���r���r�����s��� r���c�������������������@���sh��e�Zd�Zdd��Zdd��Zdd��Zdd�d d �Zdd��Zd d��Zd�ddd�dd�Z d�ddddddd�dd�Z d�dd�Zd�dd�Zd�dd�Z d�dd�Zdd ��Zd!d"��Zd#d$��Zd%d&��Zd'd(��Zd)d*��Zd+d,��Zd-d.��Zd/d0��Zd1d2��Zd3d4��Zd5d6��Zd7d8��Zd9d:��Zd;d<��Zejfd=d>�Z d?d@��Z!dAdB��Z"ddC�dDdE�Z#ddC�dFdG�Z$ddC�dHdI�Z%dJdK��Z&dLdM��Z'dNdO��Z(ddC�dPdQ�Z)dRdS��Z*dTdU��Z+dVdW��Z,dXdXdXdXdY�dZd[�Z-d�d\d]�Z.d�dd^�d_d`�Z/dadb��Z0dcdd��Z1dedf��Z2d�dgdh�Z3d�ddXdXdXdddddddi� djdk�Z4d�dldm�Z5d�dd^�dndo�Z6dpdq��Z7drds��Z8ddddt�dudv�Z9d�dXdXdXe:ddddw�dxdy�Z;dXe<j=dXdXdY�dzd{�Z>d|d}��Z?d�e<j@e<jAdd~dddddd� d�d��ZBddd��d�d��ZCd�d���ZDd�d���ZEd�d���ZFeGjHeGjHeGjHdddXdddd�� d�d��ZIeGjHeGjHeGjHdddXdddd�� d�d��ZJd�d���ZKd�d���ZLd�d���ZMd�d���ZNd�d���ZOd�d���ZPd�d���ZQd�d���ZRd�d���ZSd�d���ZTd�d���ZUdS�)�r���c�����������������C���s����d|�_�d|�_d|�_t���|�_g�|�_d�|�_d|�_d�|�_ t �d�j|�_ d�|�_|��t�����d|�_d�|�_d�|�_d|�_d�|�_t���|�_d|�_d|�_d�S�)Nr���F� monotonicg�������?)�_timer_cancelled_count�_closed� _stoppingrI����deque�_ready� _scheduled�_default_executorZ _internal_fds� _thread_id�time�get_clock_infoZ resolution�_clock_resolution�_exception_handler� set_debugr���Z_is_debug_mode�slow_callback_duration�_current_handle� _task_factory�"_coroutine_origin_tracking_enabled�&_coroutine_origin_tracking_saved_depth�weakref�WeakSet� _asyncgens�_asyncgens_shutdown_called�_executor_shutdown_calledrw���r���r���r���rm������s&���� zBaseEventLoop.__init__c�������������� ���C���s.���d|�j�j��d|������d|������d|������d� S�)Nr����z running=z closed=z debug=r����)r����r����� is_running� is_closed� get_debugrw���r���r���r���r�������s�������zBaseEventLoop.__repr__c�����������������C���s���t�j|�d�S�)N�r����)r����Futurerw���r���r���r���ri������s����zBaseEventLoop.create_futureN)�namec����������������C���sN���|������|�jd�u�r2tj||�|d�}|jrJ|jd=�n|��|�|�}t�||��|S�)N)r����r�������)� _check_closedr����r���r����_source_tracebackZ_set_task_name)rk����coror����Ztaskr���r���r����create_task���s���� zBaseEventLoop.create_taskc�����������������C���s"���|d�urt�|�std��||�_d�S�)Nz'task factory must be a callable or None)�callabler8���r����)rk����factoryr���r���r����set_task_factory���s���� zBaseEventLoop.set_task_factoryc�����������������C���s���|�j�S�rE���)r����rw���r���r���r����get_task_factory���s����zBaseEventLoop.get_task_factory)�extra�serverc����������������C���s���t��d�S�rE�����NotImplementedError)rk���r,����protocolr����r����r����r���r���r����_make_socket_transport���s����z$BaseEventLoop._make_socket_transportFT)�server_side�server_hostnamer����r����r�����call_connection_madec����������������C���s���t��d�S�rE���r����)rk���Zrawsockr����� sslcontextr����r����r����r����r����r����r����r���r���r����_make_ssl_transport���s����z!BaseEventLoop._make_ssl_transportc�����������������C���s���t��d�S�rE���r����)rk���r,���r�����addressr����r����r���r���r����_make_datagram_transport���s����z&BaseEventLoop._make_datagram_transportc�����������������C���s���t��d�S�rE���r�����rk����piper����r����r����r���r���r����_make_read_pipe_transport���s����z'BaseEventLoop._make_read_pipe_transportc�����������������C���s���t��d�S�rE���r����r����r���r���r����_make_write_pipe_transport���s����z(BaseEventLoop._make_write_pipe_transportc ����������� ����������s���t��d�S�rE���r����) rk���r�����args�shell�stdin�stdout�stderr�bufsizer�����kwargsr���r���r����_make_subprocess_transport���s����z(BaseEventLoop._make_subprocess_transportc�����������������C���s���t��d�S�rE���r����rw���r���r���r����_write_to_self���s����zBaseEventLoop._write_to_selfc�����������������C���s���t��d�S�rE���r����)rk���� event_listr���r���r����_process_events���s����zBaseEventLoop._process_eventsc�����������������C���s���|�j�rtd��d�S�)NzEvent loop is closed)r����rr���rw���r���r���r���r������s����zBaseEventLoop._check_closedc�����������������C���s���|�j�rtd��d�S�)Nz!Executor shutdown has been called)r����rr���rw���r���r���r����_check_default_executor��s����z%BaseEventLoop._check_default_executorc�����������������C���s*���|�j��|��|����s&|��|�j|�����d�S�rE���)r�����discardr�����call_soon_threadsafer�����aclose�rk����agenr���r���r����_asyncgen_finalizer_hook ��s����z&BaseEventLoop._asyncgen_finalizer_hookc�����������������C���s.���|�j�rtjd|�d�t|�d��|�j�|��d�S�)Nzasynchronous generator z3 was scheduled after loop.shutdown_asyncgens() call��source)r�����warnings�warn�ResourceWarningr�����addr����r���r���r����_asyncgen_firstiter_hook��s���� �z&BaseEventLoop._asyncgen_firstiter_hookc���������������������s����d|�_�t|�j�sd�S�t|�j�}|�j����tjdd��|D��d|�d��I�d�H�}t||�D�]*\}}t|t �rT|�� d|��||d���qTd�S�)NTc�����������������S���s���g�|�]}|�����qS�r���)r����)rF���Zagr���r���r���� <listcomp>$��r/���z4BaseEventLoop.shutdown_asyncgens.<locals>.<listcomp>)Zreturn_exceptionsr����z;an error occurred during closing of asynchronous generator )�messagerU���Zasyncgen)r�����lenr����rK����clearr����_gather�zipr���� Exception�call_exception_handler)rk���Z closing_agens�results�resultr����r���r���r����shutdown_asyncgens��s&���� � ��z BaseEventLoop.shutdown_asyncgensc���������������������s\���d|�_�|�jd�u�rd�S�|����}tj|�j|fd�}|����z|I�d�H��W�|����n |����0�d�S�)NT)�targetr����)r����r����ri���� threading�Thread�_do_shutdown�start�join)rk����future�threadr���r���r����shutdown_default_executor1��s���� z'BaseEventLoop.shutdown_default_executorc�������������� ���C���sX���z |�j�jdd��|��|jd���W�n2�tyR�}�z|��|j|��W�Y�d�}~n d�}~0�0�d�S�)NT��wait)r�����shutdownr����ry���r��ru���)rk���r ���exr���r���r���r ��>��s ����zBaseEventLoop._do_shutdownc�����������������C���s(���|�����rtd��t���d�ur$td��d�S�)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)r����rr���r���Z_get_running_looprw���r���r���r����_check_runningE��s�����zBaseEventLoop._check_runningc�������������� ���C���s����|������|�����|��|�j��t���|�_t���}tj |�j |�jd��zJt� |���|�����|�jrLq^qLW�d|�_d�|�_t� d���|��d��tj |���n,d|�_d�|�_t� d���|��d��tj |���0�d�S�)N)� firstiter� finalizerF)r����r���_set_coroutine_origin_tracking�_debugr��� get_identr�����sys�get_asyncgen_hooks�set_asyncgen_hooksr����r����r���Z_set_running_loop� _run_oncer����)rk���Zold_agen_hooksr���r���r����run_foreverL��s.���� � � zBaseEventLoop.run_foreverc�������������� ���C���s����|������|�����t�|��}tj||�d�}|r4d|_|�t��zFz|�� ���W�n*���|rp|� ��rp|���sp|������Y�n0�W�|� t��n|� t��0�|� ��s�td��|���S�)Nr����Fz+Event loop stopped before Future completed.)r����r��r���Zisfuturer���Z ensure_futureZ_log_destroy_pending�add_done_callbackr[���r��r����rT���rU���Zremove_done_callbackrr���r��)rk���r ��Znew_taskr���r���r����run_until_completec��s"���� z BaseEventLoop.run_until_completec�����������������C���s ���d|�_�d�S�r����)r����rw���r���r���r���rX������s����zBaseEventLoop.stopc�����������������C���sp���|�����rtd��|�jrd�S�|�jr,t�d|���d|�_|�j����|�j����d|�_ |�j }|d�urld�|�_ |jdd��d�S�)Nz!Cannot close a running event loopzClose %rTFr��)r����rr���r����r��r����debugr����r����r����r����r����r���rk����executorr���r���r���r�������s���� zBaseEventLoop.closec�����������������C���s���|�j�S�rE���)r����rw���r���r���r���r�������s����zBaseEventLoop.is_closedc�����������������C���s0���|�����s,|d|���t|�d��|����s,|�����d�S�)Nzunclosed event loop r����)r����r����r����r����)rk����_warnr���r���r����__del__���s����zBaseEventLoop.__del__c�����������������C���s ���|�j�d�uS�rE���)r����rw���r���r���r���r�������s����zBaseEventLoop.is_runningc�����������������C���s���t����S�rE���)r����r����rw���r���r���r���r�������s����zBaseEventLoop.time)�contextc����������������G���s4���|�j�|����|�|g|�R�d|i�}|jr0|jd=�|S�)Nr&��r����)�call_atr����r����)rk����delay�callbackr&��r�����timerr���r���r���� call_later���s�����zBaseEventLoop.call_laterc����������������G���sZ���|������|�jr"|�����|��|d��t�||||�|�}|jrB|jd=�t�|�j |��d|_ |S�)Nr'��r����T) r����r��� _check_thread�_check_callbackr���ZTimerHandler�����heapq�heappushr����)rk����whenr)��r&��r����r*��r���r���r���r'�����s����zBaseEventLoop.call_atc����������������G���sB���|������|�jr"|�����|��|d��|��|||�}|jr>|jd=�|S�)N� call_soonr����)r����r��r,��r-��� _call_soonr�����rk���r)��r&��r����r���r���r���r���r1�����s���� zBaseEventLoop.call_soonc�����������������C���sD���t��|�st��|�r$td|��d���t|�s@td|��d|����d�S�)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r���ZiscoroutineZiscoroutinefunctionr8���r����)rk���r)���methodr���r���r���r-�����s���� � ���zBaseEventLoop._check_callbackc�����������������C���s.���t��|||�|�}|jr|jd=�|�j�|��|S�)Nr����)r����Handler����r����r<���)rk���r)��r����r&��r���r���r���r���r2����s ����zBaseEventLoop._call_soonc�����������������C���s,���|�j�d�u�rd�S�t���}||�j�kr(td��d�S�)NzMNon-thread-safe operation invoked on an event loop other than the current one)r����r��r��rr���)rk���Z thread_idr���r���r���r,�� ��s���� �zBaseEventLoop._check_threadc����������������G���sB���|������|�jr|��|d��|��|||�}|jr6|jd=�|�����|S�)Nr����r����)r����r��r-��r2��r����r����r3��r���r���r���r������s����z"BaseEventLoop.call_soon_threadsafec�����������������G���sh���|������|�jr|��|d��|d�u�rL|�j}|�����|d�u�rLtjjdd�}||�_tj|j |g|�R���|�d�S�)N�run_in_executorZasyncio)Zthread_name_prefixr����) r����r��r-��r����r����� concurrentr����ThreadPoolExecutorZwrap_future�submit)rk���r#���funcr����r���r���r���r6��%��s������zBaseEventLoop.run_in_executorc�����������������C���s&���t�|tjj�st�dtd��||�_d�S�)Nz{Using the default executor that is not an instance of ThreadPoolExecutor is deprecated and will be prohibited in Python 3.9����)r���r7��r���r8��r����r�����DeprecationWarningr����r"��r���r���r����set_default_executor5��s�����z"BaseEventLoop.set_default_executorc�����������������C���s����|��d|��g}|r$|��d|����|r8|��d|����|rL|��d|����|r`|��d|����d�|�}t�d|��|����}t�||||||�} |����|�} d|��d | d �d�d| ��}| |�jkr�t�|��n t�|��| S�) N�:zfamily=ztype=zproto=zflags=�, zGet address info %szGetting address info z took g�����@�@z.3fzms: ) r<���r��r���r!��r����r&����getaddrinfor�����info)rk���r>���r?���r@���rA���rB����flags�msg�t0�addrinfo�dtr���r���r����_getaddrinfo_debug>��s&���� z BaseEventLoop._getaddrinfo_debugr����r@���rA���rB���rB��c������������� �������s2���|�j�r|�j}ntj}|��d�|||||||�I�d�H�S�rE���)r��rG��r&���r@��r6��)rk���r>���r?���r@���rA���rB���rB��Zgetaddr_funcr���r���r���r@��V��s�����zBaseEventLoop.getaddrinfoc���������������������s���|���d�tj||�I�d�H�S�rE���)r6��r&����getnameinfo)rk���ZsockaddrrB��r���r���r���rI��`��s���� �zBaseEventLoop.getnameinfo)�fallbackc������������� �������s����|�j�r|���dkrtd��t|��|��||||��z|��||||�I�d�H�W�S��tjyv�}�z|sb��W�Y�d�}~n d�}~0�0�|��||||�I�d�H�S�)Nr���zthe socket must be non-blocking) r��� gettimeoutr'���r`����_check_sendfile_params�_sock_sendfile_nativer����SendfileNotAvailableError�_sock_sendfile_fallback)rk���r,����file�offset�countrJ��rZ���r���r���r���� sock_sendfiled��s������zBaseEventLoop.sock_sendfilec���������������������s���t��d|�d|�d���d�S�)Nz-syscall sendfile is not available for socket z and file z combination�r���rN���rk���r,���rP��rQ��rR��r���r���r���rM��s��s ������z#BaseEventLoop._sock_sendfile_nativec����������� ��� �������s����|r|��|��|rt|tj�ntj}t|�}d}z�|rNt||�|�}|dkrNq�t|�d�|��}|��d�|j|�I�d�H�} | szq�|��||d�| ���I�d�H��|| 7�}q2|W�|dkr�t |d�r�|��||���S�n&|dk��r�t |d���r�|��||���0�d�S�)Nr����seek) rV���minr���Z!SENDFILE_FALLBACK_READBUFFER_SIZE� bytearray� memoryviewr6���readintoZsock_sendallr%���) rk���r,���rP��rQ��rR��� blocksize�buf� total_sent�view�readr���r���r���rO��z��s6���� �� ���z%BaseEventLoop._sock_sendfile_fallbackc�����������������C���s����dt�|dd�vrtd��|jtjks,td��|d�urbt|t�sLtd�|���|dkrbtd�|���t|t�sztd�|���|dk�r�td�|���d�S�)N�b�modez$file should be opened in binary modez+only SOCK_STREAM type sockets are supportedz+count must be a positive integer (got {!r})r���z0offset must be a non-negative integer (got {!r})) r���r'���rA���r&���r4���r���r7���r8����formatrU��r���r���r���rL�����s2���� �� ����z$BaseEventLoop._check_sendfile_paramsc���������������������sD��g�}|��|��|\}}}}} d�} z�tj|||d�} | �d��|d�ur�|D�]t\}}}}}z| �|��W��q�W�qH�ty��}�z8d|�d|j������} t|j| �}|��|��W�Y�d�}~qHd�}~0�0�qH|����|�� | | �I�d�H��| W�S��t�y �}�z*|��|��| d�u�r | � �����W�Y�d�}~n(d�}~0����| d�u�r8| � �����Y�n0�d�S�)N�r@���rA���rB���Fz*error while attempting to bind on address �: )r<���r&����setblocking�bindr*����strerror�lower�errno�pop�sock_connectr����)rk���r���Z addr_infoZlocal_addr_infosZ my_exceptionsr@����type_rB����_r����r,����laddrrZ���rC��r���r���r���� _connect_sock���sB���� ���" zBaseEventLoop._connect_sock) r_���r@���rB���rB��r,���� local_addrr����r�����happy_eyeballs_delay� interleavec������� ������ �������sz��| d�ur|st�d��| d�u�r0|r0|s,t�d��|} |d�urD|sDt�d��|d�urTt|��|d�urh| d�u�rhd} |d�usz|d�u�r�|d�ur�t�d���j||f|tj||�d�I�d�H�}|s�td��| d�ur�j| |tj||�d�I�d�H���s�td��nd��| r�t|| �}g���|d�u��rV|D�]B}z ����|��I�d�H�}W���q�W�n�t�yN���Y��qY�n0��qn.tj ����fdd �|D��|�d �I�d�H�\}}}|d�u��r.dd����D����t ���dk�r���d ��nJt��d ���t�fdd ���D����r��d ��td� d�dd ����D������n.|d�u��rt�d��|jtjk�r.t�d|�����j|||| |d�I�d�H�\}}�j�rr|�d�}t�d|||||��||fS�)Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a host�1ssl_handshake_timeout is only meaningful with sslr����8host/port and sock can not be specified at the same time�r@���rA���rB���rB��r�����!getaddrinfo() returned empty listc�����������������3���s ���|�]}t���j��|��V��qd�S�rE���)� functools�partialro��)rF���rE��)r����laddr_infosrk���r���r���rH���!��s�����z2BaseEventLoop.create_connection.<locals>.<genexpr>r����c�����������������S���s���g�|�]}|D�]}|�qqS�r���r���)rF����subrZ���r���r���r���r����'��r/���z3BaseEventLoop.create_connection.<locals>.<listcomp>r���c�����������������3���s���|�]}t�|���kV��qd�S�rE����r����rF���rZ���)�modelr���r���rH���-��r/���zMultiple exceptions: {}r?��c�����������������s���s���|�]}t�|�V��qd�S�rE���r{��r|��r���r���r���rH���2��r/���z5host and port was not specified and no sock specified�"A Stream Socket was expected, got )r����r&���z%r connected to %s:%r: (%r, %r))r'���r`����_ensure_resolvedr&���r4���r*���rS���ro��r ���Zstaggered_racer����r����allrb��r��rA����_create_connection_transportr���get_extra_infor���r!��)rk���r����r>���r?���r_���r@���rB���rB��r,���rp��r����r����rq��rr���infosrE��rm��rs���r����r���)r���ry��r}��rk���r����create_connection���s������� �� � �� � ��� �zBaseEventLoop.create_connectionc�������������� �������s����|��d��|��}|����}|rHt|t�r*d�n|} |�j||| ||||d�} n|��|||�} z|I�d�H��W�n���| ������Y�n0�| |fS�)NF�r����r����r����)re��ri���r����boolr����r����r����)rk���r,���r����r_���r����r����r����r����r����r����rs���r���r���r���r���M��s"���� �z*BaseEventLoop._create_connection_transportc������������� �������s����|����rtd��t|dtjj�}|tjju�r:td|����|tjju�r�z|��||||�I�d�H�W�S��tj y��}�z|sv��W�Y�d�}~n d�}~0�0�|s�td|����|�� ||||�I�d�H�S�)NzTransport is closingZ_sendfile_compatiblez(sendfile is not supported for transport zHfallback is disabled and native sendfile is not supported for transport )rn���rr���r���r���Z _SendfileModeZUNSUPPORTEDZ TRY_NATIVE�_sendfile_nativer���rN���_sendfile_fallback)rk���rs���rP��rQ��rR��rJ��ra��rZ���r���r���r����sendfileg��s4����������zBaseEventLoop.sendfilec���������������������s���t��d��d�S�)Nz!sendfile syscall is not supportedrT��)rk���rl���rP��rQ��rR��r���r���r���r������s�����zBaseEventLoop._sendfile_nativec�������������� �������s|��|r|��|��|rt|d�nd}t|�}d}t|�}�z|r�t||�|�}|dkr�|W�|dkrvt|d�rv|��||���|���I�d�H��S�t|�d�|��} |��d�|j| �I�d�H�} | s�|W�|dkr�t|d�r�|��||���|���I�d�H��S�|� ��I�d�H��|� | d�| ����|| 7�}q8W�|dk�r4t|d��r4|��||���|���I�d�H��n4|dk�rht|d��rh|��||���|���I�d�H��0�d�S�)Ni�@��r���rV��)rV��rW��rX��ra���r%���r����rY��r6��rZ��rp����write)rk���rl���rP��rQ��rR��r[��r\��r]��rB���r^��r_��r���r���r���r������s@���� ���z BaseEventLoop._sendfile_fallbackr���c������������� �������s����t�d�u�rtd��t|t�j�s*td|����t|dd�sFtd|�d���|����}tj|�||||||dd�}|� ���|� |��|��|j|�} |��|j �} z|I�d�H��W�n,�ty����|����| ����| ������Y�n0�|jS�)Nz"Python ssl module is not availablez@sslcontext is expected to be an instance of ssl.SSLContext, got Z_start_tls_compatibleFz transport z is not supported by start_tls())r����r����)r_���rr���r���Z SSLContextr8���r���ri���r ���ZSSLProtocolrf���rg���r1��rt���r���� BaseExceptionr����r����Z_app_transport)rk���rs���r����r����r����r����r����r����Zssl_protocolZ conmade_cbZ resume_cbr���r���r���� start_tls���s>���� �� �� zBaseEventLoop.start_tls)r@���rB���rB��� reuse_address� reuse_port�allow_broadcastr,���c���������� ����������s��| d�ur�| j�tjkr"td| ������s>�s>|s>|s>|s>|s>| r~t���|||||| d�}d�dd��|���D���}td|��d���| �d��d�} �n��s��s�|d kr�td ��||fdff}�n�ttd��r�|tj k�r����fD�]}|d�ur�t |t�s�td ��qڈ��rx��d �dv�rxz"t �t� ���j��r.t�����W�nF�t�yD���Y�n4�t�yv�}�zt�d��|��W�Y�d�}~n d�}~0�0�||f���fff}n�i�}d ��fd�ffD�]�\}}|d�u�r�t |t��r�t|�dk�s�td��|�j||tj|||�d�I�d�H�}|�s�td��|D�]:\}}}}}||f}||v�r0d�d�g||<�|||�|<��q�q����fdd�|���D��}|�sjtd��g�}|tu�r�|�r�td��ntjdtdd��|D�]�\\}}\}}d�} d�} zxtj|tj|d�} |�r�t| ��| �r�| �tjtj d��| �d�����r| �!|����r*| �s&|��"| |�I�d�H��|} W�n`�t�yn�}�z(| d�u�rP| �#���|�$|��W�Y�d�}~n.d�}~0����| d�u�r�| �#�����Y�n0���q��q�|d ��|��}|��%��}|��&| || |�}|�j'�r���r�t�(d���||��nt�)d�||��z|I�d�H��W�n���|�#�����Y�n0�||fS�)NzA UDP Socket was expected, got )rp���remote_addrr@���rB���rB��r���r���r���r?��c�����������������s���s$���|�]\}}|r|��d�|���V��qdS�)�=Nr���)rF����k�vr���r���r���rH������r/���z9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>zKsocket modifier keyword arguments can not be used when sock is specified. (�)Fr���zunexpected address family)NN�AF_UNIXzstring is expected)r�����z2Unable to check or remove stale UNIX socket %r: %rr���r;��z2-tuple is expectedru��rv��c��������������������s8���g�|�]0\}}��r|d��du�s�r,|d�du�s||f�qS�)r���Nr���r���)rF����keyZ addr_pair�rp��r���r���r���r����&��s����z:BaseEventLoop.create_datagram_endpoint.<locals>.<listcomp>zcan not get address informationz~Passing `reuse_address=True` is no longer supported, as the usage of SO_REUSEPORT in UDP poses a significant security concern.zdThe *reuse_address* parameter has been deprecated as of 3.5.10 and is scheduled for removal in 3.11.)� stacklevelrc��z@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))*rA���r&���r5���r'����dictr���itemsre��r%���r���r���r���r8����stat�S_ISSOCK�os�st_mode�remove�FileNotFoundErrorr*���r����errorr����r����r���_unsetr����r����r<��r-���r(���r)����SO_BROADCASTrf��rk��r����r<���ri���r����r��rA��r!��) rk���r����rp��r���r@���rB���rB��r���r���r���r,���ZoptsZproblemsZr_addrZaddr_pairs_inforR����errZ addr_infos�idxr���Zfamrm��Zpror����r���r���Z local_addressZremote_addressrZ���r����r����rs���r���r���r����create_datagram_endpoint���s������������ �� � � ��� � ���z&BaseEventLoop.create_datagram_endpointc���������� ����������s^���|d�d��\}}t�|||||g|dd����R���} | d�ur>| gS�|j||||||d�I�d�H�S�d�S�)Nr;��rH��)rD���r@��) rk���r����r@���rA���rB���rB��r����r>���r?���rA��r���r���r���r��t��s���� �zBaseEventLoop._ensure_resolvedc���������������������s8���|�j�||f|tj||�d�I�d�H�}|s4td|�d���|S�)N)r@���rA���rB��r����zgetaddrinfo(z) returned empty list)r��r&���r4���r*���)rk���r>���r?���r@���rB��r���r���r���r����_create_server_getaddrinfo���s�����z(BaseEventLoop._create_server_getaddrinfor���) r@���rB��r,���r����r_���r���r���r����r����c������� �������������s���t�|t�rtd��|d�ur*|d�u�r*td��|d�ur:t|��|d�usL�d�u�rL|d�ur\td��| d�u�rxtjdkovtjdk} g�} |dkr�d�g}n$t�|t �s�t�|t jj�s�|g}n|}�����fdd�|D��}t j|d �i�I�d�H�}ttj�|��}d }�z8|D��]}|\}}}}}zt�|||�}W�n6�tj�yV����j�rNtjd|||dd ��Y�q�Y�n0�| �|��| �rz|�tjtjd��| �r�t|��t�r�|tjk�r�ttd��r�|�tj tj!d��z|�"|��W�q��t#�y�}�z(t#|j$d||j%�&��f��d��W�Y�d�}~q�d�}~0�0�q�d}W�|�sJ| D�]}|�'����qn|�sH| D�]}|�'����q80�n4|d�u��r^td��|j(tj)k�rztd|����|g} | D�]}|�*d ���q�t+�| ||||�}|�r�|�,���t �-d�I�d�H���j�r�t�.d|��|S�)Nz*ssl argument must be an SSLContext or Noners��rt���posix�cygwinr0���c��������������������s���g�|�]}�j�|����d���qS�))r@���rB��)r���)rF���r>����r@���rB��r?���rk���r���r���r�������s���� �z/BaseEventLoop.create_server.<locals>.<listcomp>r����Fz: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 specifiedr~��r���z %r is serving)/r���r���r8���r'���r`���r���r����r���platformr���rI����abc�Iterabler���r����setrN���rO���rP���r&���r���r��r����warningr<���r(���r)����SO_REUSEADDRr-���r;���r���r%���r����IPV6_V6ONLYrf��r*���ri��rg��rh��r����rA���r4���re��r���r����r����rA��)rk���r����r>���r?���r@���rB��r,���r����r_���r���r���r����r����r�����hosts�fsr���Z completed�resrC����socktyperB���� canonname�sar���r����r���r���r���� create_server���s����� �� �� � ������� �zBaseEventLoop.create_server)r_���r����c��������������������s����|j�tjkrtd|����|d�ur.|s.td��|d�ur>t|��|�j|||dd|d�I�d�H�\}}|�jr~|�d�}t� d|||��||fS�)Nr~��rs��r0���T)r����r����r&���z%r handled: (%r, %r)) rA���r&���r4���r'���r`���r���r��r���r���r!��)rk���r����r,���r_���r����rs���r����r���r���r����connect_accepted_socket���s ����� � z%BaseEventLoop.connect_accepted_socketc���������������������sd���|��}|�����}|��|||�}z|I�d�H��W�n���|������Y�n0�|�jr\t�d|���||��||fS�)Nz Read pipe %r connected: (%r, %r))ri���r����r����r��r���r!���fileno�rk���r����r����r����r����rs���r���r���r����connect_read_pipe ��s���� �zBaseEventLoop.connect_read_pipec���������������������sd���|��}|�����}|��|||�}z|I�d�H��W�n���|������Y�n0�|�jr\t�d|���||��||fS�)Nz!Write pipe %r connected: (%r, %r))ri���r����r����r��r���r!��r���r���r���r���r����connect_write_pipe0��s���� �z BaseEventLoop.connect_write_pipec�����������������C���s����|g}|d�ur"|��dt|������|d�urJ|tjkrJ|��dt|������n8|d�urf|��dt|������|d�ur�|��dt|������t�d�|���d�S�)Nzstdin=zstdout=stderr=zstdout=zstderr=� )r<���r#���r���r!���r���r!��r��)rk���rC��r����r����r����rA��r���r���r����_log_subprocess@��s����zBaseEventLoop._log_subprocess) r����r����r�����universal_newlinesr����r�����encoding�errors�textc������� �������������s����t�|ttf�std��|r"td��|s.td��|dkr>td��|rJtd��| d�urZtd��| d�urjtd��|��} d�}|�jr�d |�}|��||||��|�j| |d ||||fi�|��I�d�H�}|�jr�|d�ur�t�d||��|| fS�)Nzcmd must be a string� universal_newlines must be Falsezshell must be Truer����bufsize must be 0�text must be False�encoding must be None�errors must be Nonezrun shell command %rT�%s: %r) r���r6���r���r'���r��r���r����r���rA��)rk���r�����cmdr����r����r����r���r����r����r���r���r���r����r����� debug_logrs���r���r���r����subprocess_shellM��s6������zBaseEventLoop.subprocess_shellc������� �������������s����|rt�d��|rt�d��|dkr(t�d��|r4t�d��| d�urDt�d��| d�urTt�d��|f|�}|��}d�}|�jr�d|��}|��||||��|�j||d ||||fi�| ��I�d�H�}|�jr�|d�ur�t�d ||��||fS�)Nr���zshell must be Falser���r���r���r���r���zexecute program Fr���)r'���r��r���r����r���rA��)rk���r����Zprogramr����r����r����r���r����r����r���r���r���r����r����Z popen_argsr����r���rs���r���r���r����subprocess_execq��s6���� ��zBaseEventLoop.subprocess_execc�����������������C���s���|�j�S�rE���)r����rw���r���r���r����get_exception_handler���s����z#BaseEventLoop.get_exception_handlerc�����������������C���s(���|d�urt�|�std|����||�_d�S�)Nz+A callable object or None is expected, got )r����r8���r����)rk����handlerr���r���r����set_exception_handler���s �����z#BaseEventLoop.set_exception_handlerc����������� ������C���s��|��d�}|sd}|��d�}|d�ur6t|�||jf}nd}d|vr`|�jd�ur`|�jjr`|�jj|d<�|g}t|�D�]�}|dv�r|qn||�}|dkr�d�t�|��}d }||� ��7�}n2|dkr�d�t�|��}d }||� ��7�}nt |�}|�|��d|�����qntj d�|�|d ��d�S�)Nr����z!Unhandled exception in event looprU���FZsource_tracebackZhandle_traceback>���rU���r����r0���z+Object created at (most recent call last): z+Handle created at (most recent call last): rd��� r���)�getrA���� __traceback__r����r�����sortedr��� traceback�format_list�rstripr���r<���r���r���) rk���r&��r����rU���r���Z log_linesr����value�tbr���r���r����default_exception_handler���s<���� ���z'BaseEventLoop.default_exception_handlerc�����������������C���s����|�j�d�u�rRz|��|��W�q��ttfy0�����Y�q��tyN���tjddd��Y�q�0�n�z|���|�|��W�n��ttfyz�����Y�nr�ty��}�zZz|��d||d���W�n6�ttfy������Y�n �ty����tjddd��Y�n0�W�Y�d�}~n d�}~0�0�d�S�)Nz&Exception in default exception handlerTr���z$Unhandled error in exception handler)r����rU���r&��zeException in default exception handler while handling an unexpected error in custom exception handler)r����r���rV���rW���r���r���r���)rk���r&��rZ���r���r���r���r�����s4���� ���z$BaseEventLoop.call_exception_handlerc�����������������C���s���|j�r d�S�|�j�|��d�S�rE���)� _cancelledr����r<����rk���r���r���r���r���� _add_callback��s����zBaseEventLoop._add_callbackc�����������������C���s���|���|��|�����d�S�rE���)r���r����r���r���r���r����_add_callback_signalsafe��s���� z&BaseEventLoop._add_callback_signalsafec�����������������C���s���|j�r|��jd7��_d�S�r]���)r����r����r���r���r���r����_timer_handle_cancelled!��s����z%BaseEventLoop._timer_handle_cancelledc�������������� ���C���s���t�|�j�}|tkr`|�j|�tkr`g�}|�jD�]}|jr<d|_q*|�|��q*t�|��||�_d|�_n4|�jr�|�jd�jr�|��jd8��_t� |�j�}d|_q`d�}|�j s�|�jr�d}n*|�jr�|�jd�j}t td||������t�}|�j�|�}|��|��|����|�j�}|�j�r:|�jd�}|j|k�r�q:t� |�j�}d|_|�j �|��q�t�|�j �}t|�D�]�} |�j ���}|j�rf�qL|�j�r�zJ||�_|����} |����|����| �}||�jk�r�t�dt|�|��W�d�|�_nd�|�_0�n|�����qLd�}d�S�)NFr���r���zExecuting %s took %.3f seconds)r����r�����_MIN_SCHEDULED_TIMER_HANDLESr�����%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr���r<���r.���heapify�heappopr����r����Z_whenrW���maxr�����MAXIMUM_SELECT_TIMEOUT� _selector�selectr����r�����range�popleftr��r����Z_runr����r���r���r���)rk���Zsched_countZ new_scheduledr����timeoutr0��r�����end_timeZntodo�irD��rF��r���r���r���r��&��sh���� �� �zBaseEventLoop._run_oncec�����������������C���sH���t�|�t�|�j�krd�S�|r2t���|�_t�tj��nt�|�j��||�_d�S�rE���)r���r����r���#get_coroutine_origin_tracking_depthr�����#set_coroutine_origin_tracking_depthr���ZDEBUG_STACK_DEPTH�rk���Zenabledr���r���r���r��t��s�������z,BaseEventLoop._set_coroutine_origin_trackingc�����������������C���s���|�j�S�rE���)r��rw���r���r���r���r�������s����zBaseEventLoop.get_debugc�����������������C���s ���||�_�|����r|��|�j|��d�S�rE���)r��r����r����r��r���r���r���r���r�������s����zBaseEventLoop.set_debug)N)N)NNN)NN)NN)N)r���)r���N)N)NN)FN)r���N)NN)NN)Vr����r����r����rm���r����ri���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r��r��r ��r��r��r ��rX���r����r����r����r����r%��r����r����r+��r'��r1��r-��r2��r,��r����r6��r=��rG��r@��rI��rS��rM��rO��rL��ro��r���r���r���r���r���r���r���r���r&���r4���r��r���r9���� AI_PASSIVEr���r���r���r���r���r���r ���r���r���r���r���r���r��r���r���r���r��r��r����r����r���r���r���r���r������s������ �� ��� ��� �� & � � %������� �/�/����� ���z� �%�"29Nr���)r���r���)r���)7rI����collections.abc�concurrent.futuresr7��rw��r.��rN���r���r&���r���r���r��r����r���r��r����r����r_����ImportErrorr0���r���r���r���r���r���r���r ���r ���r���r���r ����logr����__all__r���r���r%���r;���r����objectr���r���r#���r-���rD���rS���r[���r^���r`����Protocolra���ZAbstractServerr���ZAbstractEventLoopr���r���r���r���r����<module>���sd��� ; Do