AlkantarClanX12

Your IP : 18.117.141.69


Current Path : /opt/alt/python312/lib64/python3.12/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/base_events.cpython-312.opt-2.pyc

�

�Q�fk0��<�	ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZ	ddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlm Z ddl!m"Z"dZ#dZ$dZ%e&e	d�Z'dZ(d�Z)d�Z*d�Z+d%d�Z,d&d�Z-d�Z.e&e	d�rd�Z/nd�Z/d�Z0Gd�d ejb�Z2Gd!�d"ejf�Z4Gd#�d$ejj�Z6y#e$rdZY��wxYw)'�N�)�	constants)�
coroutines)�events)�
exceptions)�futures)�	protocols)�sslproto)�	staggered)�tasks)�timeouts)�
transports)�trsock)�logger)�
BaseEventLoop�Server�dg�?�AF_INET6i�Qc��|j}tt|dd�tj�rt|j�St|�S)N�__self__)�	_callback�
isinstance�getattrr�Task�reprr�str)�handle�cbs  �:/opt/alt/python312/lib64/python3.12/asyncio/base_events.py�_format_handler Hs=��	�	�	�B��'�"�j�$�/����<��B�K�K� � ��6�{��c�h�|tjk(ry|tjk(ryt|�S)Nz<pipe>z<stdout>)�
subprocess�PIPE�STDOUTr)�fds r�_format_piper'Qs+��	�Z�_�_���	�z� � �	 ���B�x�r!c���ttd�std��	|jtjtj
d�y#t$rtd��wxYw)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��socks r�_set_reuseportr2Zs`���6�>�*��D�E�E�	J��O�O�F�-�-�v�/B�/B�A�F���	J��I�J�
J�	J�s�/A
�
A"c	�P�ttd�sy|dtjtjhvs|�y|tjk(rtj}n%|tj
k(rtj}ny|�d}n<t
|t�r|dk(rd}n$t
|t�r|dk(rd}n	t|�}|tjk(r7tjg}tr#|jtj �n|g}t
|t�r|j#d�}d|vry|D]I}	tj$||�tr |tj k(r
|||d||||ffcS|||d||ffcSy#ttf$rYywxYw#t&$rY�mwxYw)N�	inet_ptonrr!��idna�%)r*r+�IPPROTO_TCP�IPPROTO_UDP�SOCK_STREAM�
SOCK_DGRAMr�bytesr�int�	TypeErrorr,�	AF_UNSPEC�AF_INET�	_HAS_IPv6�appendr�decoder4r/)	�host�port�family�type�proto�flowinfo�scopeid�afs�afs	         r�_ipaddr_inforMes����6�;�'���Q��*�*�F�,>�,>�?�?��L���v�!�!�!��"�"��	
��"�"�	"��"�"����|���	�D�%�	 �T�S�[���	�D�#�	�4�2�:���	��t�9�D���!�!�!��~�~�����J�J�v���'��h���$����{�{�6�"��
�d�{����	����R��&��R�6�?�?�2��4���T�4��7�,K�K�K��4���T�4�L�8�8����;�:�&�	��	��2�	��	�s*�7F�;9F�7F�F�F�	F%�$F%c��	tj�}|D]$}|d}||vrg||<||j|��&t|j	��}g}|dkDr%|j|dd|dz
�|dd|dz
�=|jd�tjjt
j|��D��|S)Nrrc3�$K�|]}|�|���
y�w�N�)�.0�as  r�	<genexpr>z(_interleave_addrinfos.<locals>.<genexpr>�s!�����
�a�
�]�	
�
�s�)
�collections�OrderedDictrB�list�values�extend�	itertools�chain�
from_iterable�zip_longest)�	addrinfos�first_address_family_count�addrinfos_by_family�addrrF�addrinfos_lists�	reordereds       r�_interleave_addrinfosrd�s���7�%�1�1�3�����a����,�,�*,���'��F�#�*�*�4�0�	�
�.�5�5�7�8�O��I�!�A�%������+�,K�-G�!�-K�L�M��A��>� :�Q� >�>�?�
�����?�?�0�0��!�!�?�3�
����r!c��|j�s'|j�}t|ttf�rytj|�j�yrP)�	cancelled�	exceptionr�
SystemExit�KeyboardInterruptr�	_get_loop�stop)�fut�excs  r�_run_until_complete_cbrn�sB���=�=�?��m�m�o���c�J�(9�:�;�
����c����!r!�TCP_NODELAYc�4�|jtjtjhvrl|jtj
k(rN|jtjk(r0|jtjtjd�yyyy�Nr)
rFr+r@rrGr:rHr8r-ror0s r�_set_nodelayrr�sj���K�K�F�N�N�F�O�O�<�<��	�	�V�/�/�/��
�
�f�0�0�0��O�O�F�.�.��0B�0B�A�F�1�0�
=r!c��yrPrQr0s rrrrr�s��r!c�\�t�&t|tj�rtd��yy)Nz"Socket cannot be of type SSLSocket)�sslr�	SSLSocketr>r0s r�_check_ssl_socketrw�s'��
��:�d�C�M�M�:��<�=�=�;�r!c�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�_SendfileFallbackProtocolc��t|tj�std��||_|j�|_|j�|_|j|_
|j�|j|�|jr*|jjj�|_yd|_y)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)�self�transps  r�__init__z"_SendfileFallbackProtocol.__init__�s����&�*�">�">�?��L�M�M� ����)�)�+���&,�&7�&7�&9��#�&,�&=�&=��#��������D�!��&�&�$(�O�O�$9�$9�$G�$G�$I�D�!�$(�D�!r!c��K�|jj�rtd��|j}|�y|�d{���y7��w)NzConnection closed by peer)r|�
is_closing�ConnectionErrorr�)r�rls  r�drainz_SendfileFallbackProtocol.drain�s<�����?�?�%�%�'�!�"=�>�>��#�#���;���	�	�s�:A�A�Ac��td��)Nz?Invalid state: connection should have been established already.��RuntimeError)r��	transports  r�connection_madez)_SendfileFallbackProtocol.connection_made�s���N�O�	Or!c���|j�B|�%|jjtd��n|jj|�|jj	|�y)NzConnection is closed by peer)r��
set_exceptionr�r~�connection_lost)r�rms  rr�z)_SendfileFallbackProtocol.connection_lost�s[��� � �,��{��%�%�3�3�#�$B�C�E��%�%�3�3�C�8����#�#�C�(r!c�p�|j�y|jjj�|_yrP)r�r|r�r��r�s r�
pause_writingz'_SendfileFallbackProtocol.pause_writing�s,��� � �,�� $��� 5� 5� C� C� E��r!c�b�|j�y|jjd�d|_y)NF)r��
set_resultr�s r�resume_writingz(_SendfileFallbackProtocol.resume_writing�s-��� � �(�����(�(��/� $��r!c��td���Nz'Invalid state: reading should be pausedr�)r��datas  r�
data_receivedz'_SendfileFallbackProtocol.data_received����D�E�Er!c��td��r�r�r�s r�eof_receivedz&_SendfileFallbackProtocol.eof_receivedr�r!c��<K�|jj|j�|jr|jj	�|j
�|j
j
�|jr|jj�yy�wrP)	r|r�r~r��resume_readingr��cancelr�r�r�s r�restorez!_SendfileFallbackProtocol.restoress�������$�$�T�[�[�1��&�&��O�O�*�*�,�� � �,�
�!�!�(�(�*��&�&��K�K�&�&�(�'�s�BBN)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rQr!rryry�s3��)��O�	)�F�
%�F�F�
)r!ryc�h�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
ed
��Zd�Z
d�Zd
�Zd�Zy)rNc��||_||_d|_g|_||_||_||_||_||_d|_	d|_
y)NrF)r��_sockets�
_active_count�_waiters�_protocol_factory�_backlog�_ssl_context�_ssl_handshake_timeout�_ssl_shutdown_timeout�_serving�_serving_forever_fut)r��loop�sockets�protocol_factory�ssl_context�backlog�ssl_handshake_timeout�ssl_shutdown_timeouts        rr�zServer.__init__sU����
���
������
�!1�����
�'���&;��#�%9��"���
�$(��!r!c�P�d|jj�d|j�d�S)N�<z	 sockets=�>)�	__class__r�r�r�s r�__repr__zServer.__repr__$s'���4�>�>�*�*�+�9�T�\�\�4D�A�F�Fr!c�.�|xjdz
c_yrq)r�r�s r�_attachzServer._attach's�����a��r!c��|xjdzc_|jdk(r|j�|j�yyy)Nrr)r�r��_wakeupr�s r�_detachzServer._detach+s;�����a�������"�t�}�}�'<��L�L�N�(=�"r!c�|�|j}d|_|D]$}|j�r�|jd��&yrP)r��doner�)r��waiters�waiters   rr�zServer._wakeup1s3���-�-����
��F��;�;�=��!�!�$�'�r!c
�*�|jryd|_|jD]p}|j|j�|jj|j||j||j|j|j��ry�NT)
r�r��listenr�r��_start_servingr�r�r�r�)r�r1s  rr�zServer._start_serving8sp���=�=����
��M�M�D��K�K��
�
�&��J�J�%�%��&�&��d�.?�.?��d�m�m�T�%@�%@��*�*�
,�"r!c��|jSrP)r�r�s r�get_loopzServer.get_loopCs���z�z�r!c��|jSrP)r�r�s r�
is_servingzServer.is_servingFs���}�}�r!c�T�|j�ytd�|jD��S)NrQc3�FK�|]}tj|����y�wrP)r�TransportSocket)rR�ss  rrTz!Server.sockets.<locals>.<genexpr>Ms����F�
�1�V�+�+�A�.�
�s�!)r��tupler�s rr�zServer.socketsIs$���=�=� ���F��
�
�F�F�Fr!c�P�|j}|�yd|_|D]}|jj|��d|_|j�;|jj�s!|jj
�d|_|jdk(r|j�yy)NFr)	r�r��
_stop_servingr�r�r�r�r�r�)r�r�r1s   r�closezServer.closeOs����-�-���?����
��D��J�J�$�$�T�*����
��%�%�1��-�-�2�2�4��%�%�,�,�.�(,�D�%�����"��L�L�N�#r!c��jK�|j�tjd��d{���y7��w)Nr)r�r�sleepr�s r�
start_servingzServer.start_servingbs%���������k�k�!�n���s�)3�1�3c��K�|j�td|�d���|j�td|�d���|j�|jj�|_	|j�d{���	d|_y7�
#tj$r1	|j�|j��d{���7�#�xYwwxYw#d|_wxYw�w)Nzserver z, is already being awaited on serve_forever()z
 is closed)
r�r�r�r�r�r�r�CancelledErrorr��wait_closedr�s r�
serve_foreverzServer.serve_foreverhs������$�$�0���$��!M�N�P�
P��=�=� �����
�;�<�<�����$(�J�J�$<�$<�$>��!�		-��+�+�+�+�)-�D�%�
,���(�(�	�
��
�
���&�&�(�(�(�����	��)-�D�%�s`�A&C�)B�8B�9B�>C�B�C�#C�?C�C�C�C�C�C�	C�Cc��K�	|j�y|jj�}|jj|�|�d{���y7��wrP)r�r�r�rB)r�r�s  rr�zServer.wait_closed}sE����	�(�=�=� �����)�)�+���
�
���V�$����s�A	A�A�ArP)r�r�r�r�r�r�r�r�r�r�r��propertyr�r�r�r�r�rQr!rrrs[��>B�)�G� ��(�	,����G��G�
�&�-�*r!rc��eZdZd�Zd�Zd�Zddd�d�Zd�Zd�Zd\ddd	�d
�Z		d\dddddddd
�d�Z
	d]d�Z		d^d�Z		d^d�Z
	d\d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd\d�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zej>fd"�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,d0d0d0d0d1�d2�Z-d_d3�Z.d`dd4�d5�Z/d6�Z0d7�Z1d8�Z2d\d9�Z3	d^dd0d0d0ddddddddd:�d;�Z4			dad<�Z5d`dd4�d=�Z6d>�Z7d?�Z8ddddd@�dA�Z9	d^d0d0d0ddddB�dC�Z:d0e;jxd0d0d1�dD�Z=dE�Z>	d^e;j~e;j�ddFdddddddG�
dH�ZAddddI�dJ�ZBdK�ZCdL�ZDdM�ZEeFj�eFj�eFj�ddd0ddddN�	dO�ZHeFj�eFj�eFj�ddd0ddddN�	dP�ZIdQ�ZJdR�ZKdS�ZLdT�ZMdU�ZNdV�ZOdW�ZPdX�ZQdY�ZRdZ�ZSd[�ZTy)brc���d|_d|_d|_tj�|_g|_d|_d|_d|_	tjd�j|_
d|_|jt!j"��d|_d|_d|_d|_d|_t/j0�|_d|_d|_y)NrF�	monotonicg�������?)�_timer_cancelled_count�_closed�	_stoppingrU�deque�_ready�
_scheduled�_default_executor�
_internal_fds�
_thread_id�time�get_clock_info�
resolution�_clock_resolution�_exception_handler�	set_debugr�_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_calledr�s rr�zBaseEventLoop.__init__�s���&'��#�������!�'�'�)������!%���������!%�!4�!4�[�!A�!L�!L���"&������z�0�0�2�3�'*��#�#���!���27��/�6:��3�"�/�/�+���*/��'�).��&r!c	��d|jj�d|j��d|j��d|j	��d�	S)Nr�z	 running=z closed=z debug=r�)r�r��
is_running�	is_closed�	get_debugr�s rr�zBaseEventLoop.__repr__�sP������'�'�(�	�$�/�/�2C�1D�E��n�n�&�'�w�t�~�~�/?�.@��
C�	
r!c�0�	tj|��S)N�r�)r�Futurer�s rr�zBaseEventLoop.create_future�s��:��~�~�4�(�(r!N)�name�contextc�&�	|j�|j�4tj||||��}|jr
|jd=|S|�|j||�}n|j|||��}tj
||�|S)N)r�r	r
����r
)�
_check_closedr�rr�_source_traceback�_set_task_name)r��coror	r
�tasks     r�create_taskzBaseEventLoop.create_task�s���	�	
�������%��:�:�d��D�'�J�D��%�%��*�*�2�.������)�)�$��5���)�)�$��g�)�F��� � ��t�,��r!c�D�	|�t|�std��||_y)Nz'task factory must be a callable or None)�callabler>r�)r��factorys  r�set_task_factoryzBaseEventLoop.set_task_factory�s*��	���x��'8��E�F�F�$��r!c��	|jSrP)r�r�s r�get_task_factoryzBaseEventLoop.get_task_factory�s��J��!�!�!r!)�extra�serverc��	t�rP��NotImplementedError)r�r1�protocolr�rrs      r�_make_socket_transportz$BaseEventLoop._make_socket_transport�s��&�!�!r!FT)�server_side�server_hostnamerrr�r��call_connection_madec��	t�rPr)r��rawsockr�
sslcontextr�r!r"rrr�r�r#s            r�_make_ssl_transportz!BaseEventLoop._make_ssl_transport�s
��	$�!�!r!c��	t�rPr)r�r1r�addressr�rs      r�_make_datagram_transportz&BaseEventLoop._make_datagram_transport�s��(�!�!r!c��	t�rPr�r��piperr�rs     r�_make_read_pipe_transportz'BaseEventLoop._make_read_pipe_transport�s��)�!�!r!c��	t�rPrr,s     r�_make_write_pipe_transportz(BaseEventLoop._make_write_pipe_transports��*�!�!r!c	��K�	t��wrPr)
r�r�args�shell�stdin�stdout�stderr�bufsizer�kwargss
          r�_make_subprocess_transportz(BaseEventLoop._make_subprocess_transports����	+�!�!�s�
c��	t�rPrr�s r�_write_to_selfzBaseEventLoop._write_to_selfs��	�"�!r!c��	t�rPr)r��
event_lists  r�_process_eventszBaseEventLoop._process_eventss��&�!�!r!c�2�|jrtd��y)NzEvent loop is closed)r�r�r�s rrzBaseEventLoop._check_closeds���<�<��5�6�6�r!c�2�|jrtd��y)Nz!Executor shutdown has been called)rr�r�s r�_check_default_executorz%BaseEventLoop._check_default_executors���)�)��B�C�C�*r!c��|jj|�|j�s+|j|j|j��yyrP)r��discardr�call_soon_threadsafer�aclose�r��agens  r�_asyncgen_finalizer_hookz&BaseEventLoop._asyncgen_finalizer_hook#s?��������%��~�~���%�%�d�&6�&6����
�F� r!c��|jr tjd|�d�t|��|jj|�y)Nzasynchronous generator z3 was scheduled after loop.shutdown_asyncgens() call��source)r�warnings�warn�ResourceWarningr��addrFs  r�_asyncgen_firstiter_hookz&BaseEventLoop._asyncgen_firstiter_hook(sA���*�*��M�M�)�$��21�2���
.�
	
�����D�!r!c��K�	d|_t|j�syt|j�}|jj	�tj|D�cgc]}|j���c}ddi��d{���}t||�D].\}}t|t�s�|jd|��||d���0ycc}w7�G�w)NT�return_exceptionsz;an error occurred during closing of asynchronous generator )�messagerg�asyncgen)r�lenr�rW�clearr�gatherrE�zipr�	Exception�call_exception_handler)r��
closing_agens�ag�results�resultrGs      r�shutdown_asyncgensz BaseEventLoop.shutdown_asyncgens1s�����:�*.��'��4�?�?�#�
��T�_�_�-�
����������$1�
2�M�b�b�i�i�k�M�
2�$�"�$�$�� ���7�L�F�D��&�)�,��+�+�"9�9=�� B�!'� $�	-��8��3�$�s$�A!C�#C�:
C�C�&C�,!Cc��K�	d|_|j�y|j�}tj|j
|f��}|j
�	tj|�4�d{���|�d{���ddd��d{���|j�y7�/7�'7�#1�d{���7swY�)xYw#t$r?tjd|�d�td��|jjd��YywxYw�w)	NT)�targetr2z:The executor did not finishing joining its threads within z	 seconds.�)�
stacklevelF��wait)rr�r��	threading�Thread�_do_shutdown�startr
�timeout�join�TimeoutErrorrLrM�RuntimeWarning�shutdown)r�rj�future�threads    r�shutdown_default_executorz'BaseEventLoop.shutdown_default_executorJs�����	�*.��&��!�!�)���#�#�%���!�!��):�):�&��K������		��'�'��0�0����1�0�
�K�K�M�1����1��0�0�0���	8��M�M�0�07�y�	�C�(�Q�
8�
�"�"�+�+��+�7�		8�s��AD
�B?�4B$�5B?�8B*�>B&�?B*�B?�B(�B?�D
�$B?�&B*�(B?�*B<�0B3�1B<�8B?�?AD�D
�D�D
c�Z�	|jjd��|j�s"|jtj
|d�yy#t$rP}|j�s6|j�s!|j|j|�Yd}~yYd}~yYd}~yd}~wwxYw)NTrd)	r�rnrrDr�_set_result_unless_cancelledrYrfr�)r�ro�exs   rrhzBaseEventLoop._do_shutdownbs���	D��"�"�+�+��+�6��>�>�#��)�)�'�*N�*N�*0�$�8�$���	D��>�>�#�F�,<�,<�,>��)�)�&�*>�*>��C�C�-?�#��	D�s�A
A�	B*�<B%�%B*c�x�|j�rtd��tj��td��y)Nz"This event loop is already runningz7Cannot run the event loop while another loop is running)rr�r�_get_running_loopr�s r�_check_runningzBaseEventLoop._check_runningls>���?�?���C�D�D��#�#�%�1��I�K�
K�2r!c��	|j�|j�|j|j�t	j
�}	t
j�|_t	j|j|j��tj|�	|j�|jrn�	d|_d|_tjd�|jd�t	j|�y#d|_d|_tjd�|jd�t	j|�wxYw)N)�	firstiter�	finalizerF)rrw�_set_coroutine_origin_tracking�_debug�sys�get_asyncgen_hooksrf�	get_identr��set_asyncgen_hooksrPrHr�_set_running_loop�	_run_oncer�)r��old_agen_hookss  r�run_foreverzBaseEventLoop.run_foreverss��)����������+�+�D�K�K�8��/�/�1��	4�'�1�1�3�D�O��"�"�T�-J�-J�-1�-J�-J�
L�
�$�$�T�*����� ��>�>����"�D�N�"�D�O��$�$�T�*��/�/��6��"�"�N�3��	#�D�N�"�D�O��$�$�T�*��/�/��6��"�"�N�3�s�A8D�AEc�"�	|j�|j�tj|�}t	j
||��}|rd|_|jt�	|j�	|jt�|j�std��|j�S#|r0|j�r |j�s|j��xYw#|jt�wxYw)NrFz+Event loop stopped before Future completed.)rrwr�isfuturer�
ensure_future�_log_destroy_pending�add_done_callbackrnr�r�rfrg�remove_done_callbackr�r^)r�ro�new_tasks   r�run_until_completez BaseEventLoop.run_until_complete�s���		�	
���������'�'��/�/���$�$�V�$�7���+0�F�'�� � �!7�8�
	@�����
�'�'�(>�?��{�{�}��L�M�M��}�}����	��F�K�K�M�&�2B�2B�2D�� � �"����'�'�(>�?�s�.B?�?5C4�4C7�7Dc��	d|_yr�)r�r�s rrkzBaseEventLoop.stop�s��	�
��r!c�n�	|j�rtd��|jry|jrt	j
d|�d|_|jj�|jj�d|_	|j}|�d|_
|jd��yy)Nz!Cannot close a running event loopzClose %rTFrd)rr�r�r|r�debugr�rVr�rr�rn�r��executors  rr�zBaseEventLoop.close�s���	��?�?���B�C�C��<�<���;�;��L�L��T�*����������������)-��&��)�)����%)�D�"����5��)� r!c��	|jSrP)r�r�s rrzBaseEventLoop.is_closed�s��8��|�|�r!c��|j�s4|d|��t|��|j�s|j�yyy)Nzunclosed event loop rJ)rrNrr�)r��_warns  r�__del__zBaseEventLoop.__del__�s=���~�~���(���1�?�4�P��?�?�$��
�
��%� r!c� �	|jduSrP)r�r�s rrzBaseEventLoop.is_running�s��8����t�+�,r!c�,�	tj�SrP)r�r�r�s rr�zBaseEventLoop.time�s��	��~�~��r!r
c��	|�td��|j|j�|z|g|��d|i�}|jr
|jd=|S)Nzdelay must not be Noner
r)r>�call_atr�r)r��delay�callbackr
r2�timers      r�
call_laterzBaseEventLoop.call_later�sd��	��=��4�5�5�����T�Y�Y�[�5�0�(�.�T�.�%,�.���"�"��'�'��+��r!c�P�	|�td��|j�|jr"|j�|j	|d�tj|||||�}|jr
|jd=tj|j|�d|_
|S)Nzwhen cannot be Noner�rT)r>rr|�
_check_thread�_check_callbackr�TimerHandler�heapq�heappushr�)r��whenr�r
r2r�s      rr�zBaseEventLoop.call_at�s���	��<��1�2�2������;�;���� �� � ��9�5��"�"�4��4��w�G���"�"��'�'��+�
���t����.�����r!c���	|j�|jr"|j�|j|d�|j	|||�}|j
r
|j
d=|S)N�	call_soonr)rr|r�r��
_call_soonr�r�r�r
r2rs     rr�zBaseEventLoop.call_soonsf��	�	
�����;�;���� �� � ��;�7�����4��9���#�#��(�(��,��
r!c��tj|�stj|�rtd|�d���t	|�std|�d|����y)Nzcoroutines cannot be used with z()z"a callable object was expected by z(), got )r�iscoroutine�iscoroutinefunctionr>r)r�r��methods   rr�zBaseEventLoop._check_callback$sg���"�"�8�,��.�.�x�8��1�&���<�>�
>���!��4�V�H�=��l�$�%�
%�"r!c��tj||||�}|jr
|jd=|jj	|�|S)Nr)r�Handlerr�rB)r�r�r2r
rs     rr�zBaseEventLoop._call_soon.sD�����x��t�W�=���#�#��(�(��,������6�"��
r!c�|�	|j�ytj�}||jk7rtd��y)NzMNon-thread-safe operation invoked on an event loop other than the current one)r�rfrr�)r��	thread_ids  rr�zBaseEventLoop._check_thread5sG��	��?�?�"���'�'�)�	�����'��'�(�
(�(r!c���	|j�|jr|j|d�|j|||�}|jr
|jd=|j�|S)NrDr)rr|r�r�rr;r�s     rrDz"BaseEventLoop.call_soon_threadsafeFsc��0������;�;�� � ��+A�B�����4��9���#�#��(�(��,������
r!c�<�|j�|jr|j|d�|�E|j}|j	�|�'t
jjd��}||_t
j|j|g|���|��S)N�run_in_executor�asyncio)�thread_name_prefixr)
rr|r�r�rA�
concurrentr�ThreadPoolExecutor�wrap_future�submit)r�r��funcr2s    rr�zBaseEventLoop.run_in_executorQs��������;�;�� � ��'8�9����-�-�H��(�(�*���%�-�-�@�@�'0�A���*2��&��"�"��H�O�O�D�(�4�(�t�5�	5r!c�p�t|tjj�st	d��||_y)Nz,executor must be ThreadPoolExecutor instance)rr�rr�r>r�r�s  r�set_default_executorz"BaseEventLoop.set_default_executoras,���(�J�$6�$6�$I�$I�J��J�K�K�!)��r!c�"�|�d|��g}|r|jd|���|r|jd|���|r|jd|���|r|jd|���dj|�}tjd|�|j	�}tj||||||�}	|j	�|z
}
d|�d	|
d
zd�d|	��}|
|jk\rtj|�|	Stj|�|	S)
N�:zfamily=ztype=zproto=zflags=�, zGet address info %szGetting address info z took g@�@z.3fzms: )	rBrkrr�r�r+�getaddrinfor��info)r�rDrErFrGrH�flags�msg�t0�addrinfo�dts           r�_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugfs����q���!�"����J�J���
�+�,���J�J��t�h�'�(���J�J���y�)�*���J�J���y�)�*��i�i��n�����*�C�0�
�Y�Y�[���%�%�d�D�&�$��u�M��
�Y�Y�[�2�
��%�c�U�&��c��#��d�8�,�O��
��,�,�,��K�K�����
�L�L����r!r�rFrGrHr�c
��K�|jr
|j}ntj}|j	d|||||||��d{���S7��wrP)r|r�r+r�r�)r�rDrErFrGrHr��getaddr_funcs        rr�zBaseEventLoop.getaddrinfo~sU�����;�;��2�2�L�!�-�-�L��)�)��,��d�F�D�%��H�H�	H�H�s�AA�A�Ac��bK�|jdtj||��d{���S7��wrP)r�r+�getnameinfo)r��sockaddrr�s   rr�zBaseEventLoop.getnameinfo�s2�����)�)��&�$�$�h��7�7�	7�7�s�&/�-�/)�fallbackc��ZK�|jr|j�dk7rtd��t|�|j	||||�	|j||||��d{���S7�#tj$r
}|s�Yd}~nd}~wwxYw|j||||��d{���7S�w)Nrzthe socket must be non-blocking)	r|�
gettimeoutr,rw�_check_sendfile_params�_sock_sendfile_nativer�SendfileNotAvailableError�_sock_sendfile_fallback)r�r1�file�offset�countr�rms       r�
sock_sendfilezBaseEventLoop.sock_sendfile�s������;�;�4�?�?�,��1��>�?�?��$���#�#�D�$���>�	��3�3�D�$�4:�E�C�C�
C�C���3�3�	�����	���1�1�$��28�%�A�A�A�	A�sN�A
B+�
A+�$A)�%A+�(B+�)A+�+B�>B�B+�B�B+�%B(�&B+c��BK�tjd|�d|�d����w)Nz-syscall sendfile is not available for socket z
 and file z combination�rr��r�r1r�r�r�s     rr�z#BaseEventLoop._sock_sendfile_native�s4�����2�2�;�D�8�D��x�|�
-�.�	.�s�c��8K�|r|j|�|rt|tj�ntj}t	|�}d}		|rt||z
|�}|dkrnYt|�d|}|j
d|j|��d{���}	|	sn#|j||d|	��d{���||	z
}�p||dkDr"t|d�r|j||z�SSS7�S7�5#|dkDr"t|d�r|j||z�wwwxYw�w)Nr�seek)
r��minr�!SENDFILE_FALLBACK_READBUFFER_SIZE�	bytearray�
memoryviewr��readinto�sock_sendallr*)
r�r1r�r�r��	blocksize�buf�
total_sent�view�reads
          rr�z%BaseEventLoop._sock_sendfile_fallback�s1������I�I�f���
��y�B�B�C�#�E�E�	��	�"���
�	/��� #�E�J�$6�	� B�I� �A�~��!�#��z�	�2��!�1�1�$��
�
�t�L�L�����'�'��d�5�D�k�:�:�:��d�"�
����A�~�'�$��"7��	�	�&�:�-�.�#8�~�M��;���A�~�'�$��"7��	�	�&�:�-�.�#8�~�sC�A
D�AC.�C*�C.�6C,�7C.�(D�*C.�,C.�.)D�Dc��dt|dd�vrtd��|jtjk(std��|�It|t�stdj|���|dkrtdj|���t|t�stdj|���|dkrtdj|���y)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})rz0offset must be a non-negative integer (got {!r}))	rr,rGr+r:rr=r>�formatr�s     rr�z$BaseEventLoop._check_sendfile_params�s����g�d�F�C�0�0��C�D�D��y�y�F�.�.�.��J�K�K����e�S�)��A�H�H��O�Q�Q���z� �A�H�H��O�Q�Q��&�#�&��B�I�I����
��A�:��B�I�I����
�r!c���K�	g}|j|�|\}}}}}	d}
	tj|||��}
|
jd�|�G|D]!\}}}}}||k7r�	|
j|�n"|r|j��t	d|�d���|j|
|	��d{���|
dx}}S#t$rP}
d|�dt|
�j
���}t	|
j|�}
|j|
�Yd}
~
��d}
~
wwxYw7�f#t$r)}
|j|
�|
�|
j��d}
~
w|
�|
j��xYw#dx}}wxYw�w)N�rFrGrHF�*error while attempting to bind on address �: z&no matching local address with family=z found)rBr+�setblocking�bindr/r�lower�errno�pop�sock_connectr�)r�r�	addr_info�local_addr_infos�
my_exceptionsrF�type_rH�_r)r1�lfamily�laddrrmr�s               r�
_connect_sockzBaseEventLoop._connect_sock�s�����2��
��
���-�(�+4�(���u�a����#	.��=�=��U�%�H�D����U�#��+�/?�+�G�Q��1�e��&�(� �	2��	�	�%�(��
0@�%�+�/�/�1�1�%�(O��y�PV�&W�X�X��#�#�D�'�2�2�2��*.�-�J���1#�2�'�',�i�r�#�c�(�.�.�2B�1C�E��&�c�i�i��5��%�,�,�S�1�1��
2��
3���	�� � ��%����
�
����	����
�
����)-�-�J��sk� E$�<D� B5�19D�*D�+D�0E$�5	D�>AD	�D�	D�D�	E�$E�E�E�E!�!E$)rurFrHr�r1�
local_addrr"r�r��happy_eyeballs_delay�
interleave�
all_errorsc��F����K�	|
�
|std��|
�|r|std��|}
|�
|std��|�
|std��|�t|�|
�|�d}|�|���|�td���j||f|tj||����d{���}|std��|	�:�j|	|tj||����d{�����s
td��d�|rt
||�}g�|
�%|D]}	�j�|���d{���}n1n/tj���fd	�|D�|
��
��d{���\}}}|�ʉD��cgc]}|D]}|���
c}}�	|rtd���t��dk(r�d�t�d��t�fd
��D��r�d�tdjdjd��D�����|�td��|j tjk7rtd|�����j#||||
||���d{���\}}�j$r+|j'd�}t)j*d|||||�||fS7���7���7��g#t
$rY���wxYw7��Kcc}}w#d�wxYw7�k�w)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 ssl�0ssl_shutdown_timeout is only meaningful with sslr�8host/port and sock can not be specified at the same time�rFrGrHr�r��!getaddrinfo() returned empty listc3�b�K�|]&}tj�j�|�����(y�wrP)�	functools�partialr�)rRr�r�laddr_infosr�s  ���rrTz2BaseEventLoop.create_connection.<locals>.<genexpr>Vs4�����,�%*���&�&�t�'9�'9�'1�8�[�J�%*�s�,/rzcreate_connection failedrc3�:�K�|]}t|��k(���y�wrP�r)rRrm�models  �rrTz2BaseEventLoop.create_connection.<locals>.<genexpr>es�����G�J�S�s�3�x�5�0�J�s�zMultiple exceptions: {}r�c3�2K�|]}t|����y�wrPr)rRrms  rrTz2BaseEventLoop.create_connection.<locals>.<genexpr>js����%E�*�3�c�#�h�*�s�z5host and port was not specified and no sock specified�"A Stream Socket was expected, got )r�r�r+z%r connected to %s:%r: (%r, %r))r,rw�_ensure_resolvedr+r:r/rdr�r�staggered_race�ExceptionGrouprUr�allr�rkrG�_create_connection_transportr|�get_extra_inforr�)r�r�rDrErurFrHr�r1r�r"r�r�rrr�infosr�r��subrmr�rrrrs`                      @@@r�create_connectionzBaseEventLoop.create_connection�so�����
	��&�s��J�K�K��"�s�� �"A�B�B�"�O� �,�S��C�E�
E� �+�C��B�D�
D����d�#��+�
�0B��J���t�/��� �N�P�P��/�/��t��V��'�'�u�E��0�N�N�E���A�B�B��%�$(�$9�$9��v��+�+�5��d�%:�%,�,��#�!�"E�F�F�"���-�e�Z�@���J�#�+� %�H�!�%)�%7�%7�&��+�&?� ?���	!&�$-�#;�#;�,�%*�,�)�t�	$5�5�
��a���|�-7�G�Z�c�3�C�c�3�c�Z�G�
�&�!�,�-G��T�T��:��!�+�(��m�+�!$�J�q�M� 2���G�J�G�G�",�Q�-�/�&�&?�&F�&F� �I�I�%E�*�%E�E�'G�H�H��|� �K�M�M��y�y�F�.�.�.�!�8���A�C�C�%)�$E�$E��"�C��"7�!5�%F�%7�7��	�8��;�;��+�+�H�5�D��L�L�:��t�T�9�h�
@��(�"�"�_N��,��" ?��#�!� �!��5��H�� "&�J�� 7�s��BJ!�I6�;J!�I9�*J!�?I?�I<�I?�*J!�J�J!�J�$J!�)A8J�!AJ!�3J�4AJ!�9J!�<I?�?	J�J!�J�J!�J!�J�J!c
��.K�|jd�|�}|j�}	|r.t|t�rdn|}
|j	|||
|	||||��}n|j|||	�}	|	�d{���||fS7�#|j
��xYw�w)NF�r!r"r�r�)r�r�r�boolr'r r�)r�r1r�rur"r!r�r�rr�r&r�s            rrz*BaseEventLoop._create_connection_transport�s�����	
�����#�%���#�#�%���!+�C��!6��C�J��0�0��h�
�F�'��&;�%9�	1�;�I��3�3�D�(�F�K�I�	��L�L�
�(�"�"�
��	��O�O���s0�A,B�/A?�4A=�5A?�9B�=A?�?B�Bc��K�	|j�rtd��t|dtjj
�}|tjj
urtd|����|tjjur	|j||||��d{���S|std|����|j||||��d{���S7�0#tj$r
}|s�Yd}~�Id}~wwxYw7�)�w)NzTransport is closing�_sendfile_compatiblez(sendfile is not supported for transport zHfallback is disabled and native sendfile is not supported for transport )r�r�rr�
_SendfileMode�UNSUPPORTED�
TRY_NATIVE�_sendfile_nativerr��_sendfile_fallback)r�r�r�r�r�r�r�rms        r�sendfilezBaseEventLoop.sendfile�s����	�,���!��5�6�6��y�"8� �.�.�:�:�<���9�*�*�6�6�6��:�9�-�H�J�
J��9�*�*�5�5�5�
�!�2�2�9�d�39�5�B�B�B���+�+4�-�9�:�
:��,�,�Y��-3�U�<�<�	<�B���7�7�
��� ��
��<�sN�BC:�C�"C�#C�&(C:�C8�C:�C�C5�(C0�+C:�0C5�5C:c��4K�tjd���w)Nz!sendfile syscall is not supportedr�)r�r�r�r�r�s     rr#zBaseEventLoop._sendfile_native�s�����2�2�/�1�	1�s�c��K�|r|j|�|rt|d�nd}t|�}d}t|�}		|rSt||z
|�}|dkr?||dkDr t	|d�r|j||z�|j��d{���St
|�d|}	|jd|j|	��d{���}
|
s?||dkDr t	|d�r|j||z�|j��d{���S|j��d{���|j|	d|
�||
z
}��7��7�y7�;7�$#|dkDr t	|d�r|j||z�|j��d{���7wxYw�w)Ni@rr�)r�r�r�ryr*r�r�r�r�r��write)r�r�r�r�r�r�r�r�rHr�r�s           rr$z BaseEventLoop._sendfile_fallback�sx������I�I�f��).�C��u�%�E�	��	�"���
�)�&�1��	"��� #�E�J�$6�	� B�I� �A�~�)��A�~�'�$��"7��	�	�&�:�-�.��-�-�/�!�!�"�#��z�	�2��!�1�1�$��
�
�t�L�L���%�
�A�~�'�$��"7��	�	�&�:�-�.��-�-�/�!�!�
�k�k�m�#�#����T�%�4�[�)��d�"�
��
"��M��
"��
$���A�~�'�$��"7��	�	�&�:�-�.��-�-�/�!�!�s��<F�E�8F�D;�F�.E�D=�E�8F�D?�F�	E�E�E�;F�=E�?F�E�9F�<E?�=F�Frc��pK�	t�td��t|tj�st	d|����t|dd�st	d|�d���|j
�}tj||||||||d��	}	|j�|j|	�|j|	j|�}
|j|j�}	|�d{���|	j"S7�#t$r2|j�|
j!�|j!��wxYw�w)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())r�r�r#)rur�r�
SSLContextr>rr�r
�SSLProtocolr�r�r�r�r��
BaseExceptionr�r��_app_transport)r�r�rr&r!r"r�r�r��ssl_protocol�
conmade_cb�	resume_cbs            r�	start_tlszBaseEventLoop.start_tls�sB����
	�
�;��C�D�D��*�c�n�n�5���!�n�&�'�
'��y�"9�5�A���Y�M�)I�J�L�
L��#�#�%���+�+��(�J����"7�!5�!&�(��	���!����|�,��^�^�L�$@�$@�)�L�
��N�N�9�#;�#;�<�	�	��L�L��*�*�*�
���	��O�O�����������		�s0�CD6� C8�%C6�&C8�*D6�6C8�8;D3�3D6)rFrHr��
reuse_port�allow_broadcastr1c	��FK�	|	��|	jtjk(rtd|	����|s|s
|s|s|s|s|rGt	|||||||��}
djd�|
j
�D��}td|�d���|	jd�d}�nb|s|s|dk(rtd	��||fd
ff}
�n�ttd�r�|tjk(r�||fD] }|��t|t�r�td��|rO|dd
vrH	tjtj|�j �rtj"|�||f||fff}
n�i}d|fd|ffD]�\}}|��	t|t,�rt/|�dk(std��|j1||tj2|||���d{���}|st'd��|D]\}}}}}||f}||vrddg||<||||<�!��|j
�D��cgc]\}}|r|d�|r|d�||f��}
}}|
std��g}|
D]�\\}}\}}d}	d}	tj|tj2|��}	|rt5|	�|r/|	j7tj8tj:d�|	jd�|r|	j=|�|r|s|j?|	|��d{���|}n|d�|�}|jE�}|jG|	|||�}|jHr4|rt)jJd||||�nt)jLd|||�	|�d{���||fS#t$$rY��0t&$r"}t)j*d||�Yd}~��Ud}~wwxYw7���cc}}w7��#t&$r/}|	�|	jA�|jB|�Yd}~���d}~w|	�|	jA��xYw7��#|jA��xYw�w)Nz$A datagram socket was expected, got )r��remote_addrrFrHr�r3r4r�c3�6K�|]\}}|s�	|�d|�����y�w)�=NrQ)rR�k�vs   rrTz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>2s!����$N�L�D�A�q�A��s�!�A�3�Z�L�s�
�zKsocket modifier keyword arguments can not be used when sock is specified. (�)Frzunexpected address family�NN�AF_UNIXzstring is expected)r�z2Unable to check or remove stale UNIX socket %r: %rrrbz2-tuple is expectedrrzcan not get address informationr�z@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rGr+r:r,�dictrk�itemsr�r*r=rrr>�stat�S_ISSOCK�os�st_mode�remove�FileNotFoundErrorr/r�errorr�rUrr;r2r-r.�SO_BROADCASTr�r�r�rBr�r*r|r�r�) r�r�r�r6rFrHr�r3r4r1�opts�problems�r_addr�addr_pairs_infora�err�
addr_infos�idxr�famr��pror)�key�	addr_pairr�
local_address�remote_addressrmrr�r�s                                 r�create_datagram_endpointz&BaseEventLoop.create_datagram_endpoint s�����
	*����y�y�F�.�.�.� �:�4�(�C�E�E��k��e�u��/��z�{�#)��e�'1�,;�=�� �9�9�$N�D�J�J�L�$N�N�� �0�08�z��<�=�=�
���U�#��F��+��Q�;�$�%@�A�A�%+�U�O�\�#B�"D�����+��&�.�.�0H�'��5�D��'�
�4��0E�'�(<�=�=�6��*�Q�-�{�"B�	6��=�=�����)<�)D�)D�E��I�I�j�1�&,�U�O�%/��$=�$?�#B�� �
�#$�j�/�A�{�3C�!D�I�C���'� *�4�� 7�C��I��N�"+�,A�"B�B�&*�&;�&;� ��f�6G�6G�"'�u�4�'<�'A�!A�� %�")�*M�"N�N�7<�3�C��C��G�#&��*�C�"�*�4�37��,�
�3��3:�J�s�O�C�0�	8=�"E�&<F�;K�;K�;M�#E�;M���i�'�I�a�L�,@�(�Y�q�\�-A��)�$�;M� �#E�
'�$�%F�G�G��J�6E�2��&�%�0�-�������!�=�=�%�F�,=�,=�U�L�D�!�&�t�,�&����"�-�-�v�/B�/B�A�G��$�$�U�+�!��	�	�-�0�"�.�"&�"3�"3�D�.�"I�I�I�!/���96E�<!��m�#�#�%���#�#�%���1�1��(�F�F�,�	��;�;�����0�&��Y��J����(�(�)�X�?�	��L�L�
�(�"�"��}-���"�6����&5�%/��6�6��6�� !A��#E�8J���+��'��
�
��%�J�%�%�c�*�*����'��
�
����*
��	��O�O���s��C"P!�%P!�6P!�AM7�P!�0AP!�N0�A
P!�N3�($P!�
B!N;�.N9�/N;�5A3P!�)P�.P	�/P�3P!�7	N-�P!�N-�N(�"P!�(N-�-P!�3P!�9N;�;	P�$O.�(P!�.P�P!�	P�P�P!c��K�|dd\}}t|||||g|dd���}	|	�|	gS|j||||||���d{���S7��w)Nrbr�)rMr�)
r�r)rFrGrHr�r�rDrEr�s
          rrzBaseEventLoop._ensure_resolved�st�����R�a�[�
��d��D�$���e�J�g�a�b�k�J�����6�M��)�)�$��V�$�05�U�*�D�D�
D�D�s�;A�A�Ac��K�|j||f|tj||���d{���}|std|�d���|S7��w)N)rFrGr�r�zgetaddrinfo(z) returned empty list)rr+r:r/)r�rDrErFr�rs      r�_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfo�s]�����+�+�T�4�L��17�1C�1C�27�d�,�D�D����L���0E�F�G�G���D�s�*A�A�Ar)
rFr�r1r�ru�
reuse_addressr3r�r�r�c
	��DK�	t|t�rtd��|�
|�td��|�
|�td��|�t	|�|�|��|�td��|	�(t
jdk(xrtjdk7}	g}|dk(rdg}n:t|t�s$t|tjj�s|g}n|}|D�cgc]}|j||||����}}tj|��d{���}t!t"j$j'|��}d	}	|D]�}|\}}}}}	t)j(|||�}|j3|�|	r/|j5t(j6t(j8d�|
rt;|�t<rR|t(j>k(r?tAt(d
�r/|j5t(jBt(jDd�	|jG|���|stId|D�cgc]}|d��	c}����d}|sS|D]}|jS��n;|�td��|jTt(jVk7rtd|����|g}|D]}|jYd	��t[|||||||�}|
r-|j]�tj^d��d{���|j,rt/j`d|�|Scc}w7��	#t(j*$r*|j,rt/j0d
|||d��Y��wxYw#tH$r�}d|�dt|�jK���}|jLtLjNk(rG|jQ�|jS�|j,rt/j0|�Yd}~���tI|jL|�d�d}~wwxYwcc}w#|s|D]}|jS��wwxYw7��@�w)Nz*ssl argument must be an SSLContext or Nonerrr�posix�cygwinr5)rFr�Fz:create_server() failed to create socket.socket(%r, %r, %r)T��exc_info�IPPROTO_IPV6r�r�z%could not bind on any address out of �z)Neither host/port nor sock were specifiedrrz
%r is serving)1rrr>r,rwrCr	r}�platformrrU�abc�IterablerYrrW�setrZr[r\r+rGr|r�warningrBr-r.�SO_REUSEADDRr2rArr*r`�IPV6_V6ONLYr�r/r�r��
EADDRNOTAVAILr�r�rGr:r�rr�r�r�)r�r�rDrErFr�r1r�rurZr3r�r�r�r��hosts�fsr�	completed�resrL�socktyperH�	canonname�sarMr�r�rs                             r�
create_serverzBaseEventLoop.create_server�s����	��c�4� ��H�I�I� �,����C�E�
E� �+����B�D�
D����d�#���t�/��� �N�P�P��$� "���7� 2� O�s�|�|�x�7O�
��G��r�z�����T�3�'� ��{���'?�'?�@������$�%�#�d��1�1�$��V�8=�2�?�#�
�%� �,�,��+�+�E��	���5�5�e�<�=�E��I�2
%� �C�9<�6�B��%��B�!�%�}�}�R��5�A���N�N�4�(�$����"�-�-�v�/B�/B�D�J�!�&�t�,�"��&�/�/�1�#�F�N�;�����(;�(;�(.�(:�(:�(,�.�
@��	�	�"�
�7!�R�!�:?�%@�%�$�d�1�g�%�%@�#C�D�D�!�	� � '���
�
��!(��|� �!L�M�M��y�y�F�.�.�.� �#E�d�X�!N�O�O��f�G��D����U�#����g�'7��W�&;�,�.����!�!�#��+�+�a�.� � ��;�;��K�K���0��
��_%�,��"�<�<�!��;�;�"�N�N�,G�+-�x���O�!�
!��0#�@�#%�c�#�h�n�n�&6� 8���9�9��(;�(;�;�#�K�K�M� �J�J�L�#�{�{� &���s� 3�$�%�c�i�i��5�4�?��@��&A��!� '���
�
��!(�!��(
!�s��C
P �L�+P �L�.P �2
O>�L�B'O>�?M�O>�O9
�*O>�5B(P �P�.P �9M�O>�
M�O>�	O6�A=O1�O>�O1�1O6�6O>�>P�P )rur�r�c	��rK�|jtjk7rtd|����|�
|std��|�
|std��|�t	|�|j|||dd||���d{���\}}|jr)|jd�}tjd|||�||fS7�@�w)	Nrrrr5T)r!r�r�r+z%r handled: (%r, %r))
rGr+r:r,rwrr|rrr�)r�r�r1rur�r�r�rs        r�connect_accepted_socketz%BaseEventLoop.connect_accepted_socketEs�����
�9�9��*�*�*��A�$��J�K�K� �,�S��C�E�
E� �+�C��B�D�
D����d�#�$(�$E�$E��"�C���"7�!5�%F�%7�7��	�8��;�;��+�+�H�5�D��L�L�/��y�(�K��(�"�"�7�s�A2B7�4B5�5AB7c��K�|�}|j�}|j|||�}	|�d{���|jr&t	j
d|j
�||�||fS7�:#|j��xYw�w)Nz Read pipe %r connected: (%r, %r))r�r.r�r|rr��fileno�r�r�r-rr�r�s      r�connect_read_pipezBaseEventLoop.connect_read_pipecs�����#�%���#�#�%���2�2�4��6�J�	�	��L�L�
�;�;��L�L�;�����	�8�
=��(�"�"�
��	��O�O����+�+B�A0�A.�A0�6B�.A0�0B�Bc��K�|�}|j�}|j|||�}	|�d{���|jr&t	j
d|j
�||�||fS7�:#|j��xYw�w)Nz!Write pipe %r connected: (%r, %r))r�r0r�r|rr�rurvs      r�connect_write_pipez BaseEventLoop.connect_write_pipess�����#�%���#�#�%���3�3�D�(�F�K�	�	��L�L�
�;�;��L�L�<�����	�8�
=��(�"�"�
��	��O�O���rxc�r�|g}|�|jdt|����|�1|tjk(r|jdt|����n>|�|jdt|����|�|jdt|����t	j
dj
|��y)Nzstdin=zstdout=stderr=zstdout=zstderr=� )rBr'r#r%rr�rk)r�r�r4r5r6r�s      r�_log_subprocesszBaseEventLoop._log_subprocess�s����u�����K�K�&��e�!4� 5�6�7���&�J�,=�,=�"=��K�K�.��f�)=�(>�?�@��!����g�l�6�&:�%;�<�=��!����g�l�6�&:�%;�<�=����S�X�X�d�^�$r!)	r4r5r6�universal_newlinesr3r7�encoding�errors�textc		���K�t|ttf�std��|rtd��|std��|dk7rtd��|rtd��|	�td��|
�td��|�}
d}|jrd	|z}|j||||�|j|
|d
||||fi|���d{���}|jr|�tjd||�||
fS7�-�w)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)	rr<rr,r|r}r9rr�)r�r��cmdr4r5r6r~r3r7rr�r�r8r�	debug_logr�s                r�subprocess_shellzBaseEventLoop.subprocess_shell�s�����#��s�|�,��3�4�4���?�@�@���1�2�2��a�<��0�1�1���1�2�2����4�5�5����2�3�3�#�%���	��;�;�/��4�I�� � ��E�6�6�B�9�$�9�9��c�4�����K�CI�K�K�	��;�;�9�0��K�K��)�Y�7��(�"�"�	K�s�B=C/�?C-�.C/c		��K�|rtd��|rtd��|dk7rtd��|rtd��|	�td��|
�td��|f|z}|�}d}|jrd|��}|j||||�|j||d	||||fi|
���d{���}|jr|�t	j
d
||�||fS7�-�w)Nr�zshell must be Falserr�r�r�r�zexecute program Fr�)r,r|r}r9rr�)r�r��programr4r5r6r~r3r7rr�r�r2r8�
popen_argsrr�r�s                  r�subprocess_execzBaseEventLoop.subprocess_exec�s������?�@�@���2�3�3��a�<��0�1�1���1�2�2����4�5�5����2�3�3��Z�$�&�
�#�%���	��;�;�+�7�+�6�I�� � ��E�6�6�B�9�$�9�9��j�%���������	��;�;�9�0��K�K��)�Y�7��(�"�"��s�B"C�$C�%.Cc��	|jSrP)r�r�s r�get_exception_handlerz#BaseEventLoop.get_exception_handler�s��	��&�&�&r!c�J�	|�t|�std|����||_y)Nz+A callable object or None is expected, got )rr>r�)r��handlers  r�set_exception_handlerz#BaseEventLoop.set_exception_handler�s:��
	���x��'8��#�#*�+�/�0�
0�")��r!c���	|jd�}|sd}|jd�}|�t|�||jf}nd}d|vr;|j�/|jjr|jj|d<|g}t|�D]�}|dvr�||}|dk(r:dj
tj|��}d	}||j�z
}nJ|dk(r:dj
tj|��}d
}||j�z
}nt|�}|j|�d|�����tjdj
|�|�
�y)NrSz!Unhandled exception in event looprgF�source_traceback�handle_traceback>rSrgr5z+Object created at (most recent call last):
z+Handle created at (most recent call last):
r��
r^)�getrG�
__traceback__r�r�sortedrk�	traceback�format_list�rstriprrBrrG)	r�r
rSrgr_�	log_linesrR�value�tbs	         r�default_exception_handlerz'BaseEventLoop.default_exception_handler�s`��
	��+�+�i�(���9�G��K�K��,�	�� ��Y���I�4K�4K�L�H��H��g�-��$�$�0��$�$�6�6��$�$�6�6�
�&�'��I�	��'�?�C��.�.���C�L�E��(�(��W�W�Y�2�2�5�9�:��F�������$���*�*��W�W�Y�2�2�5�9�:��F�������$���U�������u�B�u�g�.�/�#� 	���T�Y�Y�y�)�H�=r!c���	|j�	|j|�y	d}|jd�}|�|jd�}|�|jd�}|�t|d�r|j�}|�*t|d�r|j|j||�y|j||�y#ttf$r�t$rtjdd��YywxYw#ttf$r�t$r[}	|jd	||d
��n:#ttf$r�t$rtjdd��YnwxYwYd}~yYd}~yd}~wwxYw)Nz&Exception in default exception handlerTr^rror�get_context�runz$Unhandled error in exception handler)rSrgr
zeException in default exception handler while handling an unexpected error in custom exception handler)r�r�rhrir-rrGr�r*r�r�)r�r
�ctx�thingrms     rrZz$BaseEventLoop.call_exception_handlersv��	�*�"�"�*�	
,��.�.�w�7�$
0������F�+���=�$�K�K��1�E��=�#�K�K��1�E��$���
�)F��+�+�-�C��?�w�s�E�':��G�G�D�3�3�T�7�C��+�+�D�'�:��3� 1�2�
�� �
,����E�&*�,�	
,��0� 1�2�
�� �
0�0��2�2�#I�%(�#*�4���
#�$5�6���$�0��L�L�"?�+/�0�0��0���	
0�sM�B8�BC-�%C-�8/C*�)C*�-E �D�E�/E�E�
E�E�E c�V�	|js|jj|�yyrP)�
_cancelledr�rB�r�rs  r�
_add_callbackzBaseEventLoop._add_callbackfs%��%�� � ��K�K���v�&�!r!c�H�	|j|�|j�yrP)r�r;r�s  r�_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafeks��D����6�"����r!c�J�	|jr|xjdz
c_yyrq)r�r�r�s  r�_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelledps$��A�����'�'�1�,�'�r!c�d�	t|j�}|tkDrr|j|ztkDr\g}|jD]'}|j
rd|_�|j
|��)tj|�||_d|_n�|jrz|jdj
ra|xjdzc_tj|j�}d|_|jr|jdj
r�ad}|js|jrd}nP|jrD|jdj}ttd||j�z
�t �}|j"j%|�}|j'|�d}|j�|j(z}|jrm|jd}|j|k\rnNtj|j�}d|_|jj
|�|jr�mt|j�}t+|�D]�}	|jj-�}|j
r�*|j.rr	||_|j�}
|j3�|j�|
z
}||j4k\r t7j8dt;|�|�d|_��|j3���d}y#d|_wxYw)NFrrzExecuting %s took %.3f seconds)rUr��_MIN_SCHEDULED_TIMER_HANDLESr��%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr�rBr��heapify�heappopr�r��_whenr��maxr��MAXIMUM_SELECT_TIMEOUT�	_selector�selectr>r��range�popleftr|r��_runr�rrfr )r��sched_count�
new_scheduledrrjr�r=�end_time�ntodo�ir�r�s            rr�zBaseEventLoop._run_onceus���	��$�/�/�*���6�6��'�'�+�5�5�
6��M��/�/���$�$�(-�F�%�!�(�(��0�	*�
�M�M�-�(�+�D�O�*+�D�'��/�/�d�o�o�a�&8�&C�&C��+�+�q�0�+����t���7��$)��!��/�/�d�o�o�a�&8�&C�&C�
���;�;�$�.�.��G�
�_�_��?�?�1�%�+�+�D��#�a���	�	��!3�4�6L�M�G��^�^�*�*�7�3�
����Z�(��
��9�9�;��!7�!7�7���o�o��_�_�Q�'�F��|�|�x�'���]�]�4�?�?�3�F� %�F���K�K���v�&�
�o�o��D�K�K� ���u��A��[�[�(�(�*�F�� � ���{�{�	0�+1�D�(�����B��K�K�M�����r�)�B��T�8�8�8����'G�'5�f�'=�r�C�,0�D�(����
�!�"���,0�D�(�s
� A)L&�&	L/c� �t|�t|j�k(ry|rDtj�|_tj
tj�||_ytj
|j�||_yrP)rr�r}�#get_coroutine_origin_tracking_depthr��#set_coroutine_origin_tracking_depthr�DEBUG_STACK_DEPTH�r��enableds  rr{z,BaseEventLoop._set_coroutine_origin_tracking�sw����=�D��!H�!H�I�I����7�7�9�
�7��3�3��+�+�
-�3:��/�
�3�3��;�;�
=�3:��/r!c��|jSrP)r|r�s rrzBaseEventLoop.get_debug�s���{�{�r!c�l�||_|j�r|j|j|�yyrP)r|rrDr{r�s  rr�zBaseEventLoop.set_debug�s.������?�?���%�%�d�&I�&I�7�S�r!rP)NNNr<)r)rN)FNN)Ur�r�r�r�r�r�rrrr r'r*r.r0r9r;r>rrArHrPr_rqrhrwr�r�rkr�rrLrMr�rr�r�r�r�r�r�r�rDr�r�r�r�r�r�r�r�r�r�rrr%r#r$r2rVr+r:rrYr?�
AI_PASSIVErqrsrwrzr}r#r$r�r�r�r�r�rZr�r�r�r�r{rr�rQr!rrr�s��/�<
�)�)-�d��*%�"�"�%)�$�"�9=�"� �$��t�"&�!%�!%�
"�CG�"�
@D�(,�"�
AE�)-�"�04�"�"�"�7�D�G�
"��2�0D�K�4�0$�L�*�.�%�M�M��-� �:>��06:��$26��&%��(�"=A�	�5� *�
�2"#��!�1�H�7�
A�(,�
A�.�/�4�*).�X59�J#����1�4��T�"&�!%�!%�$��J#�\*/�"&�!%�	#�8-<�#'�-<�^1�"�4%*�(,�.2�-1�	.+�bEI�D#�./�q��26�7;�$�	D#�N'(�f�.@�.@�%&�a�
D��59�I��#�#��#�#������"&�!%��I�Z�"&�!%�	#�<#� #� %�&0�_�_�&0�o�o�&0�o�o�27�%)�1�(,�T��
"#�J%/�O�O�J�O�O�%/�_�_��$)�1�'+�D�t�	 #�D'�
*�"0>�dF0�P'�
�
-�
N�`
:��Tr!r)rr)r)7rU�collections.abc�concurrent.futuresr�r�r
r�rZrCr+rAr#rfr�r�r}rLr�ru�ImportErrorr5rrrrrr	r
rrr
rr�logr�__all__r�r�r*rAr�r r'r2rMrdrnrrrw�Protocolry�AbstractServerr�AbstractEventLooprrQr!r�<module>r�s0��
��������	�
������
������������������$��
 #��),�%�
�F�J�'�	�#����J�8�v�,"��6�=�!�G�
�>�
A)�	� 2� 2�A)�HB�V�
"�
"�B�JBT�F�,�,�BT��k��
�C��s�D�D�D