AlkantarClanX12

Your IP : 3.12.123.41


Current Path : /opt/alt/python311/lib64/python3.11/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/asyncio/__pycache__/base_events.cpython-311.opt-2.pyc

�

c��fx&��4�	ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZ	ddlZn
#e$rdZYnwxYwddlmZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddl 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�Z/Gd�dej0��Z1Gd �d!ej2��Z3Gd"�d#ej4��Z5dS)&�N�)�	constants)�
coroutines)�events)�
exceptions)�futures)�	protocols)�sslproto)�	staggered)�tasks)�
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/python311/lib64/python3.11/asyncio/base_events.py�_format_handlerGsF��	�	�B��'�"�j�$�/�/���<�<���B�K� � � ��6�{�{��c�h�|tjkrdS|tjkrdSt|��S)Nz<pipe>z<stdout>)�
subprocess�PIPE�STDOUTr)�fds r�_format_piper&Ps2��	�Z�_����x�	�z� �	 �	 ��z��B�x�x�r c���ttd��std���	|�tjtjd��dS#t$rtd���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_reuseportr1Ys����6�>�*�*�J��D�E�E�E�	J��O�O�F�-�v�/B�A�F�F�F�F�F���	J�	J�	J��I�J�J�
J�	J���s�+A�A-c	�^�ttd��sdS|dtjtjhvs|�dS|tjkr
tj}n|tjkr
tj}ndS|�d}net
|t��r	|dkrd}nGt
|t��r	|dkrd}n)	t|��}n#ttf$rYdSwxYw|tjkr4tj
g}tr|�tj��n|g}t
|t��r|�d��}d|vrdS|D]V}	tj||��tr|tjkr
|||d||||ffcS|||d||ffcS#t&$rY�SwxYwdS)N�	inet_ptonrr ��idna�%)r)r*�IPPROTO_TCP�IPPROTO_UDP�SOCK_STREAM�
SOCK_DGRAMr�bytesr�int�	TypeErrorr+�	AF_UNSPEC�AF_INET�	_HAS_IPv6�appendr�decoder3r.)	�host�port�family�type�proto�flowinfo�scopeid�afs�afs	         r�_ipaddr_inforLds���6�;�'�'�����Q��*�F�,>�?�?�?��L��t��v�!�!�!��"���	
��"�	"�	"��"����t��|����	�D�%�	 �	 �	�T�S�[�[����	�D�#�	�	��4�2�:�:����	��t�9�9�D�D���:�&�	�	�	��4�4�	������!�!�!��~����	(��J�J�v��'�'�'���h���$����#��{�{�6�"�"��
�d�{�{��t��	�	��	���R��&�&�&��
9�R�6�?�2�2��4���T�4��7�,K�K�K�K�K��4���T�4�L�8�8�8�8���	�	�	��D�	�����4s*�5C�C�C�6F�F�
F*�)F*c���	tj��}|D].}|d}||vrg||<||�|���/t|�����}g}|dkr4|�|dd|dz
���|dd|dz
�=|�d�tj�t
j	|���D����|S)Nrrc3�K�|]}|�|V��	dS�N�)�.0�as  r�	<genexpr>z(_interleave_addrinfos.<locals>.<genexpr>�s0�������
�]�	
�
�]�]�]��r )
�collections�OrderedDictrA�list�values�extend�	itertools�chain�
from_iterable�zip_longest)�	addrinfos�first_address_family_count�addrinfos_by_family�addrrE�addrinfos_lists�	reordereds       r�_interleave_addrinfosrc�s%��7�%�1�3�3���1�1���a����,�,�,�*,���'��F�#�*�*�4�0�0�0�0��.�5�5�7�7�8�8�O��I�!�A�%�%������+�,K�-G�!�-K�,K�L�M�M�M��A��>� :�Q� >�>�?�
������?�0�0��!�?�3�
�
��������r c���|���s2|���}t|ttf��rdStj|�����dSrO)�	cancelled�	exceptionr�
SystemExit�KeyboardInterruptr�	_get_loop�stop)�fut�excs  r�_run_until_complete_cbrm�sa���=�=�?�?���m�m�o�o���c�J�(9�:�;�;�	�
�F���c�����!�!�!�!�!r �TCP_NODELAYc��|jtjtjhvrW|jtjkrD|jtjkr1|�tjtj	d��dSdSdSdS�Nr)
rEr*r?rrFr9rGr7r,rnr/s r�_set_nodelayrq�sn���K�F�N�F�O�<�<�<��	�V�/�/�/��
�f�0�0�0��O�O�F�.��0B�A�F�F�F�F�F�
=�<�/�/�0�0r c��dSrOrPr/s rrqrq�s���r c�j�t�)t|tj��rtd���dSdS)Nz"Socket cannot be of type SSLSocket)�sslr�	SSLSocketr=r/s r�_check_ssl_socketrv�s1��
��:�d�C�M�:�:���<�=�=�=����r c�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�_SendfileFallbackProtocolc��t|tj��std���||_|���|_|���|_|j	|_
|���|�|��|j
r%|jj
���|_dSd|_dS)Nz.transport should be _FlowControlMixin instance)rr
�_FlowControlMixinr=�
_transport�get_protocol�_proto�
is_reading�_should_resume_reading�_protocol_paused�_should_resume_writing�
pause_reading�set_protocol�_loop�
create_future�_write_ready_fut)�self�transps  r�__init__z"_SendfileFallbackProtocol.__init__�s����&�*�">�?�?�	N��L�M�M�M� ����)�)�+�+���&,�&7�&7�&9�&9��#�&,�&=��#����������D�!�!�!��&�	)�$(�O�$9�$G�$G�$I�$I�D�!�!�!�$(�D�!�!�!r c��K�|j���rtd���|j}|�dS|�d{V��dS)NzConnection closed by peer)r{�
is_closing�ConnectionErrorr�)r�rks  r�drainz_SendfileFallbackProtocol.drain�sR�����?�%�%�'�'�	?�!�"=�>�>�>��#���;��F��	�	�	�	�	�	�	�	�	r c� �td���)Nz?Invalid state: connection should have been established already.��RuntimeError)r��	transports  r�connection_madez)_SendfileFallbackProtocol.connection_made�s���N�O�O�	Or c���|j�D|�(|j�td����n|j�|��|j�|��dS)NzConnection is closed by peer)r��
set_exceptionr�r}�connection_lost)r�rls  rr�z)_SendfileFallbackProtocol.connection_lost�sw��� �,��{��%�3�3�#�$B�C�C�E�E�E�E��%�3�3�C�8�8�8���#�#�C�(�(�(�(�(r c�^�|j�dS|jj���|_dSrO)r�r{r�r��r�s r�
pause_writingz'_SendfileFallbackProtocol.pause_writing�s/��� �,��F� $�� 5� C� C� E� E����r c�Z�|j�dS|j�d��d|_dS)NF)r��
set_resultr�s r�resume_writingz(_SendfileFallbackProtocol.resume_writing�s5��� �(��F���(�(��/�/�/� $����r c� �td����Nz'Invalid state: reading should be pausedr�)r��datas  r�
data_receivedz'_SendfileFallbackProtocol.data_received����D�E�E�Er c� �td���r�r�r�s r�eof_receivedz&_SendfileFallbackProtocol.eof_receivedr�r c��K�|j�|j��|jr|j���|j�|j���|jr|j���dSdSrO)	r{r�r}r�resume_readingr��cancelr�r�r�s r�restorez!_SendfileFallbackProtocol.restores�������$�$�T�[�1�1�1��&�	-��O�*�*�,�,�,�� �,�
�!�(�(�*�*�*��&�	)��K�&�&�(�(�(�(�(�	)�	)r N)�__name__�
__module__�__qualname__r�r�r�r�r�r�r�r�r�rPr rrxrx�s�������)�)�)����O�O�O�	)�	)�	)�F�F�F�
%�%�%�F�F�F�F�F�F�
)�
)�
)�
)�
)r rxc�p�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
ed
���Zd�Z
d�Zd
�Zd�ZdS)rNc��||_||_d|_g|_||_||_||_||_||_d|_	d|_
dS)NrF)r��_sockets�
_active_count�_waiters�_protocol_factory�_backlog�_ssl_context�_ssl_handshake_timeout�_ssl_shutdown_timeout�_serving�_serving_forever_fut)r��loop�sockets�protocol_factory�ssl_context�backlog�ssl_handshake_timeout�ssl_shutdown_timeouts        rr�zServer.__init__s[����
���
������
�!1�����
�'���&;��#�%9��"���
�$(��!�!�!r c�2�d|jj�d|j�d�S)N�<z	 sockets=�>)�	__class__r�r�r�s r�__repr__zServer.__repr__#s"��F�4�>�*�F�F�T�\�F�F�F�Fr c�&�|xjdz
c_dSrp)r�r�s r�_attachzServer._attach&s�����a�����r c�z�|xjdzc_|jdkr|j�|���dSdSdS)Nrr)r�r��_wakeupr�s r�_detachzServer._detach*sJ�����a�������"�"�t�}�'<��L�L�N�N�N�N�N�#�"�'<�'<r c�~�|j}d|_|D]+}|���s|�|���,dSrO)r��doner�)r��waiters�waiters   rr�zServer._wakeup0sN���-����
��	*�	*�F��;�;�=�=�
*��!�!�&�)�)�)��	*�	*r c
���|jrdSd|_|jD]U}|�|j��|j�|j||j||j|j|j	���VdS�NT)
r�r��listenr�r��_start_servingr�r�r�r�)r�r0s  rr�zServer._start_serving7s����=�	��F���
��M�	,�	,�D��K�K��
�&�&�&��J�%�%��&��d�.?��d�m�T�%@��*�
,�
,�
,�
,�	,�	,r c��|jSrO)r�r�s r�get_loopzServer.get_loopBs
���z�r c��|jSrO)r�r�s r�
is_servingzServer.is_servingEs
���}�r c�P�|j�dStd�|jD����S)NrPc3�>K�|]}tj|��V��dSrO)r�TransportSocket)rQ�ss  rrSz!Server.sockets.<locals>.<genexpr>Ls-����F�F�1�V�+�A�.�.�F�F�F�F�F�Fr )r��tupler�s rr�zServer.socketsHs.���=� ��2��F�F��
�F�F�F�F�F�Fr c�8�|j}|�dSd|_|D]}|j�|���d|_|j�9|j���s |j���d|_|jdkr|���dSdS)NFr)	r�r��
_stop_servingr�r�r�r�r�r�)r�r�r0s   r�closezServer.closeNs����-���?��F���
��	+�	+�D��J�$�$�T�*�*�*�*���
��%�1��-�2�2�4�4�
2��%�,�,�.�.�.�(,�D�%����"�"��L�L�N�N�N�N�N�#�"r c��fK�|���tjd���d{V��dS)Nr)r�r�sleepr�s r�
start_servingzServer.start_servingas@�����������k�!�n�n���������r c��K�|j�td|�d����|j�td|�d����|���|j���|_	|j�d{V��nH#tj$r6	|���|�	���d{V���#�xYwwxYw	d|_dS#d|_wxYw)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_forevergs(�����$�0��N�$�N�N�N�P�P�
P��=� ��;��;�;�;�<�<�<�������$(�J�$<�$<�$>�$>��!�		-��+�+�+�+�+�+�+�+�+���(�	�	�	�
��
�
�����&�&�(�(�(�(�(�(�(�(�(�������	����
,�)-�D�%�%�%���D�%�,�,�,�,s6�*
A8�7C
�8B=�.B7�6B=�7B9�9B=�=C
�
	Cc��K�|j�|j�dS|j���}|j�|��|�d{V��dSrO)r�r�r�r�rA)r�r�s  rr�zServer.wait_closed|sX�����=� �D�M�$9��F���)�)�+�+���
���V�$�$�$����������r rO)r�r�r�r�r�r�r�r�r�r�r��propertyr�r�r�r�r�rPr rrrs�������>B�)�)�)�)�G�G�G� � � ����*�*�*�	,�	,�	,��������G�G��X�G�
���&���-�-�-�*����r rc
�J�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�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Zejfd"�Z d#�Z!d$�Z"dd%�d&�Z#dd%�d'�Z$dd%�d(�Z%d)�Z&d*�Z'd+�Z(dd%�d,�Z)d-�Z*d.�Z+d/�Z,d0d0d0d0d1�d2�Z-d_d3�Z.d`dd4�d5�Z/d6�Z0d7�Z1d8�Z2d\d9�Z3	d^dd0d0d0dddddddd:�d;�Z4			dad<�Z5d`dd4�d=�Z6d>�Z7d?�Z8ddddd@�dA�Z9	d^d0d0d0ddddB�dC�Z:d0e;j<d0d0d1�dD�Z=dE�Z>	d^e;j?e;j@ddFdddddddG�
dH�ZAddddI�dJ�ZBdK�ZCdL�ZDdM�ZEeFjGeFjGeFjGddd0ddddN�	dO�ZHeFjGeFjGeFjGddd0ddddN�	dP�ZIdQ�ZJdR�ZKdS�ZLdT�ZMdU�ZNdV�ZOdW�ZPdX�ZQdY�ZRdZ�ZSd[�ZTdS)brc��d|_d|_d|_tj��|_g|_d|_d|_d|_	tjd��j|_
d|_|�t!j����d|_d|_d|_d|_d|_t/j��|_d|_d|_dS)NrF�	monotonicg�������?)�_timer_cancelled_count�_closed�	_stoppingrT�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�[�!A�!A�!L���"&������z�0�2�2�3�3�3�'*��#�#���!���27��/�6:��3�"�/�+�+���*/��'�).��&�&�&r c	��d|jj�d|����d|����d|����d�	S)Nr�z	 running=z closed=z debug=r�)r�r��
is_running�	is_closed�	get_debugr�s rr�zBaseEventLoop.__repr__�sp��
C���'�
C�
C�$�/�/�2C�2C�
C�
C��n�n�&�&�
C�
C�/3�~�~�/?�/?�
C�
C�
C�	
r c�.�	tj|���S)N�r�)r�Futurer�s rr�zBaseEventLoop.create_future�s��:��~�4�(�(�(�(r N)�name�contextc��	|���|j�(tj||||���}|jr|jd=nF|�|�||��}n|�|||���}tj||��|S)N)r�rr	����r	)�
_check_closedr�rr�_source_traceback�_set_task_name)r��cororr	�tasks     r�create_taskzBaseEventLoop.create_task�s���	�	
��������%��:�d��D�'�J�J�J�D��%�
/��*�2�.�����)�)�$��5�5����)�)�$��g�)�F�F��� ��t�,�,�,��r c�V�	|�t|��std���||_dS)Nz'task factory must be a callable or None)�callabler=r�)r��factorys  r�set_task_factoryzBaseEventLoop.set_task_factory�s9��	���x��'8�'8���E�F�F�F�$����r c��	|jSrO)r�r�s r�get_task_factoryzBaseEventLoop.get_task_factory�s��J��!�!r )�extra�serverc��	t�rO��NotImplementedError)r�r0�protocolr�rrs      r�_make_socket_transportz$BaseEventLoop._make_socket_transport�s��&�!�!r FT)�server_side�server_hostnamerrr�r��call_connection_madec��	t�rOr)r��rawsockr�
sslcontextr�r r!rrr�r�r"s            r�_make_ssl_transportz!BaseEventLoop._make_ssl_transport�s
��	$�!�!r c��	t�rOr)r�r0r�addressr�rs      r�_make_datagram_transportz&BaseEventLoop._make_datagram_transport�s��(�!�!r c��	t�rOr�r��piperr�rs     r�_make_read_pipe_transportz'BaseEventLoop._make_read_pipe_transport�s��)�!�!r c��	t�rOrr+s     r�_make_write_pipe_transportz(BaseEventLoop._make_write_pipe_transport�s��*�!�!r c	��K�	t�rOr)
r�r�args�shell�stdin�stdout�stderr�bufsizer�kwargss
          r�_make_subprocess_transportz(BaseEventLoop._make_subprocess_transport�s����	+�!�!r c��	t�rOrr�s r�_write_to_selfzBaseEventLoop._write_to_self�s��	�"�!r c��	t�rOr)r��
event_lists  r�_process_eventszBaseEventLoop._process_eventss��&�!�!r c�2�|jrtd���dS)NzEvent loop is closed)r�r�r�s rr
zBaseEventLoop._check_closeds%���<�	7��5�6�6�6�	7�	7r c�2�|jrtd���dS)Nz!Executor shutdown has been called)rr�r�s r�_check_default_executorz%BaseEventLoop._check_default_executor
s)���)�	D��B�C�C�C�	D�	Dr c��|j�|��|���s/|�|j|�����dSdSrO)r��discardr�call_soon_threadsafer�aclose�r��agens  r�_asyncgen_finalizer_hookz&BaseEventLoop._asyncgen_finalizer_hooks^�������%�%�%��~�~���	G��%�%�d�&6����
�
�F�F�F�F�F�	G�	Gr c��|jr tjd|�d�t|���|j�|��dS)Nzasynchronous generator z3 was scheduled after loop.shutdown_asyncgens() call��source)r��warnings�warn�ResourceWarningr��addrEs  r�_asyncgen_firstiter_hookz&BaseEventLoop._asyncgen_firstiter_hooks_���*�	.��M�2�$�2�2�2���
.�
.�
.�
.�
	
����D�!�!�!�!�!r c��pK�	d|_t|j��sdSt|j��}|j���tjd�|D��ddi��d{V��}t||��D]6\}}t|t��r|�
d|��||d����7dS)NTc�6�g|]}|�����SrP)rD)rQ�ags  r�
<listcomp>z4BaseEventLoop.shutdown_asyncgens.<locals>.<listcomp>)s ��
2�
2�
2�b�b�i�i�k�k�
2�
2�
2r �return_exceptionsz;an error occurred during closing of asynchronous generator )�messagerf�asyncgen)r��lenr�rV�clearr�gather�zipr�	Exception�call_exception_handler)r��
closing_agens�results�resultrFs     r�shutdown_asyncgensz BaseEventLoop.shutdown_asyncgenss����:�*.��'��4�?�#�#�	�
�F��T�_�-�-�
����������
2�
2�M�
2�
2�
2�$�"�$�$�$�$�$�$�$�$�� ���7�7�	�	�L�F�D��&�)�,�,�
��+�+� B�9=� B� B�!'� $�	-�-�����	�	r c�� K�	d|_|j�dS|���}tj|j|f���}|���	|�d{V��|���dS#|���wxYw)NT)�targetr1)rr�r��	threading�Thread�_do_shutdown�start�join)r��future�threads   r�shutdown_default_executorz'BaseEventLoop.shutdown_default_executor5s�����<�)-��&��!�)��F��#�#�%�%���!��):�&��K�K�K��������	��L�L�L�L�L�L�L��K�K�M�M�M�M�M��F�K�K�M�M�M�M���s�A7�7B
c�:�	|j�d���|���s|�|jd��dSdS#t
$r@}|���s!|�|j|��Yd}~dSYd}~dSd}~wwxYw)NT��wait)r��shutdownrrCr�r[r�)r�rh�exs   rrezBaseEventLoop._do_shutdownBs���	D��"�+�+��+�6�6�6��>�>�#�#�
C��)�)�&�*;�T�B�B�B�B�B�
C�
C���	D�	D�	D��>�>�#�#�
D��)�)�&�*>��C�C�C�C�C�C�C�C�C�
D�
D�
D�
D�
D�
D�����	D���s�A
A�
B�/B�Bc��|���rtd���tj���td���dS)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_runningKsS���?�?���	E��C�D�D�D��#�%�%�1��I�K�K�
K�2�1r c��	|���|���|�|j��t	j��}	t
j��|_t	j	|j
|j���tj
|��	|���|jrn�	d|_d|_tj
d��|�d��t	j	|�dS#d|_d|_tj
d��|�d��t	j	|�wxYw)N)�	firstiter�	finalizerTF)r
rr�_set_coroutine_origin_tracking�_debug�sys�get_asyncgen_hooksrc�	get_identr��set_asyncgen_hooksrOrGr�_set_running_loop�	_run_oncer�)r��old_agen_hookss  r�run_foreverzBaseEventLoop.run_foreverRs[��)��������������+�+�D�K�8�8�8��/�1�1��	4�'�1�3�3�D�O��"�T�-J�-1�-J�
L�
L�
L�
L�
�$�T�*�*�*�
���� � � ��>���
��"�D�N�"�D�O��$�T�*�*�*��/�/��6�6�6��"�N�3�3�3�3��	#�D�N�"�D�O��$�T�*�*�*��/�/��6�6�6��"�N�3�3�3���s�A*D
�
AEc��	|���|���tj|��}t	j||���}|rd|_|�t��	|�	��nD#|r<|�
��r(|���s|����xYw	|�
t��n#|�
t��wxYw|�
��std���|���S)NrFz+Event loop stopped before Future completed.)r
rrr�isfuturer�
ensure_future�_log_destroy_pending�add_done_callbackrmrr�rerf�remove_done_callbackr�r_)r�rh�new_tasks   r�run_until_completez BaseEventLoop.run_until_completejsI��		�	
�������������'��/�/�/���$�V�$�7�7�7���	0�+0�F�'�� � �!7�8�8�8�
	@���������	��
#�F�K�K�M�M�
#�&�2B�2B�2D�2D�
#�� � �"�"�"�����
�
�'�'�(>�?�?�?�?��F�'�'�(>�?�?�?�?�����{�{�}�}�	N��L�M�M�M��}�}���s�9B�
C.�AC�C.�.D
c��	d|_dSr�)r�r�s rrjzBaseEventLoop.stop�s��	�
����r c�h�	|���rtd���|jrdS|jrt	jd|��d|_|j���|j���d|_	|j
}|�d|_
|�d���dSdS)Nz!Cannot close a running event loopzClose %rTFrl)rr�r�rwr�debugr�rXr�rr�rn�r��executors  rr�zBaseEventLoop.close�s���	��?�?���	D��B�C�C�C��<�	��F��;�	+��L��T�*�*�*������������������)-��&��)����%)�D�"����5��)�)�)�)�)� �r c��	|jSrO)r�r�s rrzBaseEventLoop.is_closed�s
��8��|�r c��|���s@|d|��t|���|���s|���dSdSdS)Nzunclosed event loop rI)rrMrr�)r��_warns  r�__del__zBaseEventLoop.__del__�sk���~�~���	��E�1��1�1�?�4�P�P�P�P��?�?�$�$�
��
�
������	�	�
�
r c��	|jduSrO)r�r�s rrzBaseEventLoop.is_running�s��8���t�+�,r c�*�	tj��SrO)r�r�r�s rr�zBaseEventLoop.time�s��	��~���r rc��	|�td���|j|���|z|g|�Rd|i�}|jr|jd=|S)Nzdelay must not be Noner	r)r=�call_atr�r)r��delay�callbackr	r1�timers      r�
call_laterzBaseEventLoop.call_later�su��	��=��4�5�5�5����T�Y�Y�[�[�5�0�(�.�T�.�.�.�%,�.�.���"�	,��'��+��r c�D�	|�td���|���|jr*|���|�|d��tj|||||��}|jr|jd=tj	|j
|��d|_
|S)Nzwhen cannot be Noner�rT)r=r
rw�
_check_thread�_check_callbackr�TimerHandler�heapq�heappushr�)r��whenr�r	r1r�s      rr�zBaseEventLoop.call_at�s���	��<��1�2�2�2��������;�	6���� � � �� � ��9�5�5�5��"�4��4��w�G�G���"�	,��'��+�
��t���.�.�.�����r c���	|���|jr*|���|�|d��|�|||��}|jr|jd=|S)N�	call_soonr)r
rwr�r��
_call_soonr�r�r�r	r1rs     rr�zBaseEventLoop.call_soon�s}��	�	
�������;�	8���� � � �� � ��;�7�7�7�����4��9�9���#�	-��(��,��
r c���tj|��stj|��rtd|�d����t	|��std|�d|�����dS)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_callbacks����"�8�,�,�	>��.�x�8�8�	>��<�&�<�<�<�>�>�
>���!�!�	%��$�V�$�$��$�$�%�%�
%�	%�	%r c��tj||||��}|jr|jd=|j�|��|S)Nr)r�Handlerr�rA)r�r�r1r	rs     rr�zBaseEventLoop._call_soon
sH����x��t�W�=�=���#�	-��(��,�����6�"�"�"��
r c�t�	|j�dStj��}||jkrtd���dS)NzMNon-thread-safe operation invoked on an event loop other than the current one)r�rcrzr�)r��	thread_ids  rr�zBaseEventLoop._check_threadsP��	��?�"��F��'�)�)�	����'�'��'�(�(�
(�(�'r c���	|���|jr|�|d��|�|||��}|jr|jd=|���|S)NrCr)r
rwr�r�rr:r�s     rrCz"BaseEventLoop.call_soon_threadsafe%s{��0��������;�	C�� � ��+A�B�B�B�����4��9�9���#�	-��(��,��������
r c�4�|���|jr|�|d��|�D|j}|���|�'t
j�d���}||_t
j|j	|g|�R�|���S)N�run_in_executor�asyncio)�thread_name_prefixr)
r
rwr�r�r@�
concurrentr�ThreadPoolExecutor�wrap_future�submit)r�r��funcr1s    rr�zBaseEventLoop.run_in_executor0s����������;�	:�� � ��'8�9�9�9����-�H��(�(�*�*�*���%�-�@�@�'0�A����*2��&��"��H�O�D�(�4�(�(�(�t�5�5�5�	5r c�p�t|tjj��st	d���||_dS)Nz,executor must be ThreadPoolExecutor instance)rr�rr�r=r�r�s  r�set_default_executorz"BaseEventLoop.set_default_executor@s8���(�J�$6�$I�J�J�	L��J�K�K�K�!)����r c�H�|�d|��g}|r|�d|����|r|�d|����|r|�d|����|r|�d|����d�|��}tjd|��|���}tj||||||��}	|���|z
}
d|�d	|
d
zd�d|	��}|
|jkrtj|��ntj|��|	S)
N�:zfamily=ztype=zproto=zflags=�, zGet address info %szGetting address info z took g@�@z.3fzms: )	rArgrr�r�r*�getaddrinfor��info)r�rCrDrErFrG�flags�msg�t0�addrinfo�dts           r�_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugEsY���!�!��!�!�"���	-��J�J�+��+�+�,�,�,��	)��J�J�'�t�'�'�(�(�(��	+��J�J�)��)�)�*�*�*��	+��J�J�)��)�)�*�*�*��i�i��n�n����*�C�0�0�0�
�Y�Y�[�[���%�d�D�&�$��u�M�M��
�Y�Y�[�[�2�
��O�c�O�O��c��O�O�O�8�O�O��
��,�,�,��K�������L������r r�rErFrGr�c
��K�|jr|j}ntj}|�d|||||||���d{V��SrO)rwr�r*r�r�)r�rCrDrErFrGr��getaddr_funcs        rr�zBaseEventLoop.getaddrinfo]sr�����;�	.��2�L�L�!�-�L��)�)��,��d�F�D�%��H�H�H�H�H�H�H�H�	Hr c��VK�|�dtj||���d{V��SrO)r�r*�getnameinfo)r��sockaddrr�s   rr�zBaseEventLoop.getnameinfogsH�����)�)��&�$�h��7�7�7�7�7�7�7�7�	7r )�fallbackc��hK�|jr'|���dkrtd���t|��|�||||��	|�||||���d{V��S#tj$r
}|s�Yd}~nd}~wwxYw|�||||���d{V��S)Nrzthe socket must be non-blocking)	rw�
gettimeoutr+rv�_check_sendfile_params�_sock_sendfile_nativer�SendfileNotAvailableError�_sock_sendfile_fallback)r�r0�file�offset�countr�rls       r�
sock_sendfilezBaseEventLoop.sock_sendfileks9�����;�	@�4�?�?�,�,��1�1��>�?�?�?��$�����#�#�D�$���>�>�>�	��3�3�D�$�4:�E�C�C�C�C�C�C�C�C�
C���3�	�	�	��
��
�
�
�
�
�����	�����1�1�$��28�%�A�A�A�A�A�A�A�A�	As�A7�7B�B�Bc��<K�tjd|�d|�d����)Nz-syscall sendfile is not available for socket z
 and file z combination�rr��r�r0r�r�r�s     rr�z#BaseEventLoop._sock_sendfile_nativezs@�����2�
-�D�
-�
-��
-�
-�
-�.�.�	.r c��|K�|r|�|��|rt|tj��ntj}t	|��}d}		|rt||z
|��}|dkrnft|��d|�}|�d|j|���d{V��}	|	sn*|�||d|	����d{V��||	z
}��||dkr)t|d��r|�||z��SSS#|dkr)t|d��r|�||z��wwwxYw)NrT�seek)
r��minr�!SENDFILE_FALLBACK_READBUFFER_SIZE�	bytearray�
memoryviewr��readinto�sock_sendallr))
r�r0r�r�r��	blocksize�buf�
total_sent�view�reads
          rr�z%BaseEventLoop._sock_sendfile_fallback�s������	��I�I�f�����
F�C��y�B�C�C�C�#�E�	��	�"�"���
�	/�

#��� #�E�J�$6�	� B� B�I� �A�~�~��!�#���z�	�z�2��!�1�1�$��
�t�L�L�L�L�L�L�L�L������'�'��d�5�D�5�k�:�:�:�:�:�:�:�:�:��d�"�
�

#���A�~�~�'�$��"7�"7�~��	�	�&�:�-�.�.�.�.��~��z�A�~�~�'�$��"7�"7�~��	�	�&�:�-�.�.�.�.��~���s
�BD	�	2D;c��dt|dd��vrtd���|jtjkstd���|�_t|t��s"td�|�����|dkr"td�|�����t|t��s"td�|�����|dkr"td�|�����dS)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+rFr*r9rr<r=�formatr�s     rr�z$BaseEventLoop._check_sendfile_params�s)���g�d�F�C�0�0�0�0��C�D�D�D��y�F�.�.�.��J�K�K�K����e�S�)�)�
Q��A�H�H��O�O�Q�Q�Q���z�z� �A�H�H��O�O�Q�Q�Q��&�#�&�&�	��B�I�I������
��A�:�:��B�I�I������
��:r c��K�	g}|j|��|\}}}}}	d}
	tj|||���}
|
�d��|��|D]�\}}}}}||kr�	|
�|��n�#t$rS}
d|�d|
j�����}t	|
j|��}
|�|
��Yd}
~
�d}
~
wwxYw|r|����t	d|�d����|�	|
|	���d{V��|
dx}}S#t$r1}
|�|
��|
�|
�
���d}
~
w|
�|
�
���xYw#dx}}wxYw)N�rErFrGF�*error while attempting to bind on address �: z&no matching local address with family=z found)rAr*�setblocking�bindr.�strerror�lower�errno�pop�sock_connectr�)r�r�	addr_info�local_addr_infos�
my_exceptionsrE�type_rG�_r(r0�lfamily�laddrrlr�s               r�
_connect_sockzBaseEventLoop._connect_sock�s ����2��
��
��-�(�(�(�+4�(���u�a����$	.��=��U�%�H�H�H�D����U�#�#�#��+�/?�Y�Y�+�G�Q��1�e��&�(�(� �
2��	�	�%�(�(�(����"�2�2�2�6�',�6�6�"�|�1�1�3�3�6�6��
&�c�i��5�5��%�,�,�S�1�1�1�1�1�1�1�1�����2����%�Y�+�/�/�1�1�1�%�&W��&W�&W�&W�X�X�X��#�#�D�'�2�2�2�2�2�2�2�2�2��*.�-�J�����	�	�	�� � ��%�%�%����
�
���������	����
�
���������)-�-�J��-�-�-�-sO�?D#�!A8�6D#�8
C�A	C�D#�C�A	D#�#
E5�-,E�E5�5E8�8E>)rtrErGr�r0�
local_addrr!r�r��happy_eyeballs_delay�
interleavec��x����K�	|
�|std���|
�|r|std���|}
|�|std���|�|std���|�t|��|
�|�d}|�|���|�td�����||f|tj||�����d{V��}|std���|	�=��|	|tj||�����d{V����std���nd�|rt
||��}g�|
�5|D]1}	���|����d{V��}n#t
$rY�.wxYwn/tj	���fd	�|D��|
��
���d{V��\}}}|��d��D���	t���dkr�d�t�d���t�fd
��D����r�d�td�
d�d��D���������#d�wxYwn8|�td���|jtjkrtd|�������||||
||����d{V��\}}�jr.|�d��}t'jd|||||��||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 ssl�0ssl_shutdown_timeout is only meaningful with sslr�8host/port and sock can not be specified at the same time�rErFrGr�r��!getaddrinfo() returned empty listc3�P�K�|] }tj�j�|���V��!dSrO)�	functools�partialr�)rQr�r�laddr_infosr�s  ���rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>5sR�����,�,�!��&�t�'9�'1�8�[�J�J�,�,�,�,�,�,r rc��g|]	}|D]}|���
SrPrP)rQ�subrls   rrSz3BaseEventLoop.create_connection.<locals>.<listcomp>;s%��G�G�G�c�3�G�G�C�c�G�G�G�Gr rc3�>�K�|]}t|���kV��dSrO�r)rQrl�models  �rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>Bs.�����G�G�S�s�3�x�x�5�0�G�G�G�G�G�Gr zMultiple exceptions: {}r�c3�4K�|]}t|��V��dSrOr)rQrls  rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>Gs(����%E�%E�3�c�#�h�h�%E�%E�%E�%E�%E�%Er 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+rv�_ensure_resolvedr*r9r.rcr�r�staggered_racerWr�allr�rgrF�_create_connection_transportrw�get_extra_inforr�)r�r�rCrDrtrErGr�r0r�r!r�r�r�r��infosr�r�r�rrrrs`                   @@@r�create_connectionzBaseEventLoop.create_connection�s���������
	��&�s�&��J�K�K�K��"�s�"��
B� �"A�B�B�B�"�O� �,�S�,��C�E�E�
E� �+�C�+��B�D�D�
D����d�#�#�#��+�
�0B��J���t�/��� �N�P�P�P��/�/��t��V��'�u�E��0�N�N�N�N�N�N�N�N�E��
C��A�B�B�B��%�$(�$9�$9��v��+�5��d�%:�%,�%,�,�,�,�,�,�,��#�G�!�"E�F�F�F�G�#���
A�-�e�Z�@�@���J�#�+� %�!�!�H�!�%)�%7�%7�&��+�&?�&?� ?� ?� ?� ?� ?� ?�����"�!�!�!� ��!�����$-�#;�,�,�,�,�,�,�%*�,�,�,�)�t�	$5�$5�$5�5�5�5�5�5�5�
��a���|�G�G�Z�G�G�G�
�
&��:���!�+�+�(��m�+�!$�J�q�M� 2� 2���G�G�G�G�J�G�G�G�G�G�0�",�Q�-�/�&�&?�&F�&F� �I�I�%E�%E�*�%E�%E�%E�E�E�'G�'G�H�H�H��"&�J�%�%�%�%��$�|� �K�M�M�M��y�F�.�.�.�!�A��A�A�C�C�C�%)�$E�$E��"�C��"7�!5�%F�%7�%7�7�7�7�7�7�7��	�8��;�	@��+�+�H�5�5�D��L�:��t�T�9�h�
@�
@�
@��(�"�"s�D>�>
E�
E�
BH�H#c
��\K�|�d��|��}|���}	|r7t|t��rdn|}
|�|||
|	||||���}n|�|||	��}	|	�d{V��n#|����xYw||fS)NF�r r!r�r�)r�r�r�boolr&rr�)r�r0r�rtr!r r�r�rr�r%r�s            rrz*BaseEventLoop._create_connection_transportes�����	
�������#�#�%�%���#�#�%�%���	L�!+�C��!6�!6�?���C�J��0�0��h�
�F�'��&;�%9�	1�;�;�I�I��3�3�D�(�F�K�K�I�	��L�L�L�L�L�L�L�L��	��O�O���������(�"�"s�B�B'c���K�	|���rtd���t|dtjj��}|tjjurtd|�����|tjjur>	|�||||���d{V��S#tj	$r
}|s�Yd}~nd}~wwxYw|std|�����|�
||||���d{V��S)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�rls        r�sendfilezBaseEventLoop.sendfile�s�����	�,���!�!�	7��5�6�6�6��y�"8� �.�:�<�<���9�*�6�6�6��H�9�H�H�J�J�
J��9�*�5�5�5�
�!�2�2�9�d�39�5�B�B�B�B�B�B�B�B�B���7�
�
�
�������������
�����	:��9�+4�9�9�:�:�
:��,�,�Y��-3�U�<�<�<�<�<�<�<�<�	<s�B�B:�-B5�5B:c��.K�tjd���)Nz!sendfile syscall is not supportedr�)r�r�r�r�r�s     rrzBaseEventLoop._sendfile_native�s�����2�/�1�1�	1r c��K�|r|�|��|rt|d��nd}t|��}d}t|��}		|rct||z
|��}|dkrJ||dkr(t	|d��r|�||z��|����d{V��St
|��d|�}	|�d|j|	���d{V��}
|
sJ||dkr(t	|d��r|�||z��|����d{V��S|�	���d{V��|�
|	d|
���||
z
}��(#|dkr(t	|d��r|�||z��|����d{V��wxYw)Ni@rTr�)r�r�r�rxr)r�r�r�r�r��write)r�r�r�r�r�r�r�r�rGr�r�s           rrz BaseEventLoop._sendfile_fallback�s�����	��I�I�f����).�9�C��u�%�%�%�E�	��	�"�"���
�)�&�1�1��	"�
#��*� #�E�J�$6�	� B� B�I� �A�~�~�)��A�~�~�'�$��"7�"7�~��	�	�&�:�-�.�.�.��-�-�/�/�!�!�!�!�!�!�!�!�"�#���z�	�z�2��!�1�1�$��
�t�L�L�L�L�L�L�L�L���&�%�
�A�~�~�'�$��"7�"7�~��	�	�&�:�-�.�.�.��-�-�/�/�!�!�!�!�!�!�!�!�
�k�k�m�m�#�#�#�#�#�#�#����T�%�4�%�[�)�)�)��d�"�
�
#���A�~�~�'�$��"7�"7�~��	�	�&�:�-�.�.�.��-�-�/�/�!�!�!�!�!�!�!�!���s�E8�5<E8�:>E8�8A
Grc��K�	t�td���t|tj��st	d|�����t|dd��st	d|�d����|���}tj||||||||d��	�	}	|�	��|�
|	��|�|	j|��}
|�|j
��}	|�d{V��nK#t$r>|���|
���|����wxYw|	jS)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")rtr�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�s�����
	�
�;��C�D�D�D��*�c�n�5�5�	'��&�!�&�&�'�'�
'��y�"9�5�A�A�	L��J�Y�J�J�J�L�L�
L��#�#�%�%���+��(�J����"7�!5�!&�(�(�(��	���!�!�!����|�,�,�,��^�^�L�$@�)�L�L�
��N�N�9�#;�<�<�	�	��L�L�L�L�L�L�L�L���	�	�	��O�O�����������������		�����*�*s
�:D�AE)rErGr��
reuse_port�allow_broadcastr0c	����K�	|	��|	jtjkrtd|	������s�s
|s|s|s|s|rZt	��|||||���}
d�d�|
���D����}td|�d����|	�d��d}�n��s �s|dkrtd	���||fd
ff}
�n�ttd��r�|tj	kr���fD](}|�$t|t��std����)�r��dd
vry	tjtj
���j��rtj���n8#t$$rYn,t&$r }t)jd�|��Yd}~nd}~wwxYw||f��fff}
n�i}d�fd�ffD]�\}}|��t|t,��rt/|��dkstd���|�||tj|||����d{V��}|st'd���|D]"\}}}}}||f}||vrddg||<||||<�#����fd�|���D��}
|
std���g}|
D�]\\}}\}}d}	d}	tj|tj|���}	|rt5|	��|r+|	�tjtjd��|	�d���r|	�|���r |s|�|	|���d{V��|}n\#t&$r0}|	�|	� ��|j!|��Yd}~��d}~w|	�|	� ���xYw|d�|��}|�"��}|�#|	|||��}|j$r2�rt)j%d��||��nt)j&d�||��	|�d{V��n#|� ���xYw||fS)Nz$A datagram socket was expected, got )r��remote_addrrErGr�r.r/r�c3�.K�|]\}}|�|�d|��V��dS)�=NrP)rQ�k�vs   rrSz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>s5����$N�$N�D�A�q�A�$N��Z�Z�A�Z�Z�$N�$N�$N�$N�$N�$Nr 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: %rr�z2-tuple is expectedrrc�F��g|]\}}�r|d��r|d�||f��S)rNrrP)rQ�key�	addr_pairr�r1s   ��rrSz:BaseEventLoop.create_datagram_endpoint.<locals>.<listcomp>BsU���#E�#E�#E�)7��i�'�#E�,5�a�L�,@�(�-A�-6�q�\�-A��)�$�-A�-A�-Ar zcan not get address informationr�z@Datagram endpoint local_addr=%r remote_addr=%r created: (%r, %r)z2Datagram endpoint remote_addr=%r created: (%r, %r))'rFr*r9r+�dictrg�itemsr�r)r8rrr=�stat�S_ISSOCK�os�st_mode�remove�FileNotFoundErrorr.r�errorr�rWrr:r1r,r-�SO_BROADCASTr�r�r�rAr�r)rwr�r�)r�r�r�r1rErGr�r.r/r0�opts�problems�r_addr�addr_pairs_infor`�err�
addr_infos�idxr�famr��pror(r<r�
local_address�remote_addressrlrr�r�s  ``                           r�create_datagram_endpointz&BaseEventLoop.create_datagram_endpoint�sR������
	*����y�F�.�.�.� �C�4�C�C�E�E�E��
=�k�
=��
=�#�
=�',�
=��
=�"1�
=��z�{�#)��e�'1�,;�=�=�=�� �9�9�$N�$N�D�J�J�L�L�$N�$N�$N�N�N�� �<�08�<�<�<�=�=�=�
���U�#�#�#��F�F��2
H�+�2
H��Q�;�;�$�%@�A�A�A�%+�U�O�\�#B�"D������+�+�.
H��&�.�0H�0H�'��5�>�>�D��'�
�4��0E�0E�'�'�(<�=�=�=���
6�*�Q�-�{�"B�"B�	6��=����)<�)<�)D�E�E�2��I�j�1�1�1���,������"�6�6�6���&5�%/��6�6�6�6�6�6�6�6�����6����&,�U�O�%/��$=�$?�#B��� �
�#$�j�/�A�{�3C�!D�;�;�I�C���'� *�4�� 7� 7�C�C��I�I��N�N�"+�,A�"B�"B�B�&*�&;�&;� ��f�6G�"'�u�4�'<�'A�'A�!A�!A�!A�!A�!A�!A�� %�O�")�*M�"N�"N�N�7<�;�;�3�C��C��G�#&��*�C�"�*�4�4�37��,�
�3��3:�J�s�O�C�0�0��#E�#E�#E�#E�#E�;E�;K�;K�;M�;M�#E�#E�#E��
'�H�$�%F�G�G�G��J�6E�
$�
$�2��&�%�0�-�������!�=�%�F�,=�U�L�L�L�D�!�-�&�t�,�,�,�&�G����"�-�v�/B�A�G�G�G��$�$�U�+�+�+�!�1��	�	�-�0�0�0�"�0�.�J�"&�"3�"3�D�.�"I�"I�I�I�I�I�I�I�I�!/���E���+�+�+��'��
�
����%�J�%�c�*�*�*�*�*�*�*�*�������'��
�
��������!��m�#�#�#�%�%���#�#�%�%���1�1��(�F�F�,�,�	��;�	?��
?���0�&��Y��J�J�J�J���(�(�)�X�?�?�?�	��L�L�L�L�L�L�L�L��	��O�O���������(�"�"sC�1?E1�1
F&�=	F&�F!�!F&�$B-M�
N$�&N�N$�P(�(P?c��K�|dd�\}}t|||||g|dd��R�}	|	�|	gS|�||||||����d{V��S)Nr:r�)rLr�)
r�r(rErFrGr�r�rCrDr�s
          rrzBaseEventLoop._ensure_resolved�s������R�a�R�[�
��d��D�$���e�J�g�a�b�b�k�J�J�J�����6�M��)�)�$��V�$�05�U�*�D�D�D�D�D�D�D�D�
Dr c��K�|�||f|tj||����d{V��}|std|�d����|S)N)rErFr�r�zgetaddrinfo(z) returned empty list)rr*r9r.)r�rCrDrEr�rs      r�_create_server_getaddrinfoz(BaseEventLoop._create_server_getaddrinfo�s������+�+�T�4�L��17�1C�27�d�,�D�D�D�D�D�D�D�D���	H��F��F�F�F�G�G�G��r r)
rEr�r0r�rt�
reuse_addressr.r�r�r�c
	������K�	t|t��rtd���|�|�td���|�|�td���|�t	|��|�����|�td���|	� t
jdkotjdk}	g}|dkrdg}n:t|t��st|tjj��s|g}n|}����fd�|D��}tj|��d{V��}tt j�|����}d	}	|D�]�}|\}}}}}	t'j|||��}n5#t&j$r#�jrt-jd
|||d���Y�TwxYw|�|��|	r+|�t&jt&jd��|
rt9|��t:rP|t&jkr@t?t&d
��r+|�t&j t&j!d��	|�"|����#tF$r�}d|�d|j$�%����}|j&tLj'krI|�(��|�)���jrt-j|��Yd}~���tG|j&|��d�d}~wwxYw|stGdd�|D�������d}|s|D]}|�)���n\#|s|D]}|�)���wwxYw|�td���|j*t&j+krtd|�����|g}|D]}|�,d	���t[�||||||��}|
r.|�.��tj/d���d{V���jrt-j0d|��|S)Nz*ssl argument must be an SSLContext or Noner�rr�posix�cygwinr4c�B��g|]}��|��������S))rEr�)rV)rQrCrEr�rDr�s  ����rrSz/BaseEventLoop.create_server.<locals>.<listcomp>�sG���%�%�%���1�1�$��V�8=�2�?�?�%�%�%r 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 c��g|]
}|d��S)�rP)rQr�s  rrSz/BaseEventLoop.create_server.<locals>.<listcomp>s��%@�%@�%@�$�d�1�g�%@�%@�%@r z)Neither host/port nor sock were specifiedrrz
%r is serving)1rrr=r+rvrBrrx�platformrrT�abc�IterablerrY�setrYrZr[r*rFrwr�warningrAr,r-�SO_REUSEADDRr1r@rr)r^�IPV6_V6ONLYr�r.r�r�r��
EADDRNOTAVAILr�r�rFr9r�rr�r�r�)r�r�rCrDrEr�r0r�rtrWr.r�r�r�r��hosts�fsr�	completed�resrK�socktyperG�	canonname�sarLr�rs`  ```                      r�
create_serverzBaseEventLoop.create_server�s2��������	��c�4� � �	J��H�I�I�I� �,����C�E�E�
E� �+����B�D�D�
D����d�#�#�#���t�/��� �N�P�P�P��$� "��7� 2� O�s�|�x�7O�
��G��r�z�z������T�3�'�'�
� ��{��'?�@�@�
�������%�%�%�%�%�%�%�#�%�%�%�B� �,��+�+�+�+�+�+�+�E��	��5�5�e�<�<�=�=�E��I�2
%� �'@�'@�C�9<�6�B��%��B�!�%�}�R��5�A�A����!�<�!�!�!��;�O�"�N�,G�+-�x���O�O�O�O�!��
!�����N�N�4�(�(�(�$�J����"�-�v�/B�D�J�J�J�!�-�&�t�,�,�,�"�.��&�/�1�1�#�F�N�;�;�2�����(;�(.�(:�(,�.�.�.�
@��	�	�"�
�
�
�
��"�@�@�@�@�#%�"�"�c�l�&8�&8�&:�&:�&:� <���9��(;�;�;�#�K�K�M�M�M� �J�J�L�L�L�#�{�4� &��s� 3� 3� 3�$�H�H�H�H�%�c�i��5�5�4�?�����@�����D�!�'�%@�%@�%�%@�%@�%@�%@�#C�D�D�D�!�	� �%� '�%�%���
�
�������!�%� '�%�%���
�
�����%�%�����|� �!L�M�M�M��y�F�.�.�.� �!N�d�!N�!N�O�O�O��f�G��	$�	$�D����U�#�#�#�#���g�'7��W�&;�,�.�.���	!��!�!�#�#�#��+�a�.�.� � � � � � � ��;�	1��K���0�0�0��
sb�5
L2�E�L2�/F�	L2�F�B-L2�:I�L2�
K3�A7K.�L2�K.�.K3�3#L2�2M)rtr�r�c	��zK�|jtjkrtd|�����|�|std���|�|std���|�t	|��|�|||dd||����d{V��\}}|jr,|�d��}tj	d|||��||fS)	Nrr�rr4T)r r�r�r*z%r handled: (%r, %r))
rFr*r9r+rvrrwrrr�)r�r�r0rtr�r�r�rs        r�connect_accepted_socketz%BaseEventLoop.connect_accepted_socket"s!����
�9��*�*�*��J�$�J�J�K�K�K� �,�S�,��C�E�E�
E� �+�C�+��B�D�D�
D����d�#�#�#�$(�$E�$E��"�C���"7�!5�%F�%7�%7�7�7�7�7�7�7��	�8��;�	L��+�+�H�5�5�D��L�/��y�(�K�K�K��(�"�"r c�� K�|��}|���}|�|||��}	|�d{V��n#|����xYw|jr)t	jd|���||��||fS)Nz Read pipe %r connected: (%r, %r))r�r-r�rwrr��fileno�r�r�r,rr�r�s      r�connect_read_pipezBaseEventLoop.connect_read_pipe@s�����#�#�%�%���#�#�%�%���2�2�4��6�J�J�	�	��L�L�L�L�L�L�L�L��	��O�O���������;�	=��L�;������	�8�
=�
=�
=��(�"�"��A�Ac�� K�|��}|���}|�|||��}	|�d{V��n#|����xYw|jr)t	jd|���||��||fS)Nz!Write pipe %r connected: (%r, %r))r�r/r�rwrr�rtrus      r�connect_write_pipez BaseEventLoop.connect_write_pipePs�����#�#�%�%���#�#�%�%���3�3�D�(�F�K�K�	�	��L�L�L�L�L�L�L�L��	��O�O���������;�	=��L�<������	�8�
=�
=�
=��(�"�"rwc��|g}|�%|�dt|������|�6|tjkr&|�dt|������nN|�%|�dt|������|�%|�dt|������t	jd�|����dS)Nzstdin=zstdout=stderr=zstdout=zstderr=� )rAr&r"r$rr�rg)r�r�r3r4r5r�s      r�_log_subprocesszBaseEventLoop._log_subprocess`s����u�����K�K�6��e�!4�!4�6�6�7�7�7���&�J�,=�"=�"=��K�K�?��f�)=�)=�?�?�@�@�@�@��!����<�l�6�&:�&:�<�<�=�=�=��!����<�l�6�&:�&:�<�<�=�=�=���S�X�X�d�^�^�$�$�$�$�$r )	r3r4r5�universal_newlinesr2r6�encoding�errors�textc		��
K�t|ttf��std���|rtd���|std���|dkrtd���|rtd���|	�td���|
�td���|��}
d}|jrd	|z}|�||||��|j|
|d
||||fi|���d{V��}|jr|�tjd||��||
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)	rr;rr+rwr|r8rr�)r�r��cmdr3r4r5r}r2r6r~rr�r7r�	debug_logr�s                r�subprocess_shellzBaseEventLoop.subprocess_shellms�����#��s�|�,�,�	5��3�4�4�4��	A��?�@�@�@��	3��1�2�2�2��a�<�<��0�1�1�1��	3��1�2�2�2����4�5�5�5����2�3�3�3�#�#�%�%���	��;�	C�/��4�I�� � ��E�6�6�B�B�B�9�$�9��c�4�����K�K�CI�K�K�K�K�K�K�K�K�	��;�	8�9�0��K��)�Y�7�7�7��(�"�"r c		��K�|rtd���|rtd���|dkrtd���|rtd���|	�td���|
�td���|f|z}|��}d}|jrd|��}|�||||��|j||d	||||fi|
���d{V��}|jr|�t	jd
||��||fS)Nr�zshell must be Falserr�r�r�r�zexecute program Fr�)r+rwr|r8rr�)r�r��programr3r4r5r}r2r6r~rr�r1r7�
popen_argsrr�r�s                  r�subprocess_execzBaseEventLoop.subprocess_exec�sb�����	A��?�@�@�@��	4��2�3�3�3��a�<�<��0�1�1�1��	3��1�2�2�2����4�5�5�5����2�3�3�3��Z�$�&�
�#�#�%�%���	��;�	C�7�7�6�6�I�� � ��E�6�6�B�B�B�9�$�9��j�%����������������	��;�	8�9�0��K��)�Y�7�7�7��(�"�"r c��	|jSrO)r�r�s r�get_exception_handlerz#BaseEventLoop.get_exception_handler�s��	��&�&r c�\�	|�!t|��std|�����||_dS)Nz+A callable object or None is expected, got )rr=r�)r��handlers  r�set_exception_handlerz#BaseEventLoop.set_exception_handler�sN��
	���x��'8�'8���/�#*�/�/�0�0�
0�")����r c���	|�d��}|sd}|�d��}|�t|��||jf}nd}d|vr"|j�|jjr|jj|d<|g}t|��D]�}|dvr�||}|dkrAd�tj|����}d	}||�	��z
}nV|dkrAd�tj|����}d
}||�	��z
}nt|��}|�|�d|������tj
d�|��|�
��dS)NrUz!Unhandled exception in event looprfF�source_traceback�handle_traceback>rUrfr4z+Object created at (most recent call last):
z+Handle created at (most recent call last):
r��
r\)�getrF�
__traceback__r�r�sortedrg�	traceback�format_list�rstriprrArrF)	r�r	rUrfr]�	log_linesr<�value�tbs	         r�default_exception_handlerz'BaseEventLoop.default_exception_handler�s���
	��+�+�i�(�(���	:�9�G��K�K��,�,�	�� ��Y����I�4K�L�H�H��H��g�-�-��$�0��$�6�1��$�6�
�&�'��I�	��'�?�?�	0�	0�C��.�.�.���C�L�E��(�(�(��W�W�Y�2�5�9�9�:�:��F��������$����*�*�*��W�W�Y�2�5�9�9�:�:��F��������$����U��������.�.�u�.�.�/�/�/�/���T�Y�Y�y�)�)�H�=�=�=�=�=�=r c���	|j�P	|�|��dS#ttf$r�t$rtjdd���YdSwxYw	|�||��dS#ttf$r�t$rc}	|�d||d���n7#ttf$r�t$rtjdd���Yn
wxYwYd}~dSYd}~dSd}~wwxYw)Nz&Exception in default exception handlerTr\z$Unhandled error in exception handler)rUrfr	zeException in default exception handler while handling an unexpected error in custom exception handler)r�r�rgrhr(rrF)r�r	rls   rr\z$BaseEventLoop.call_exception_handler�s���	�*�"�*�	
,��.�.�w�7�7�7�7�7��� 1�2�
�
�
�� �
,�
,�
,���E�&*�,�,�,�,�,�,�,�	
,����
0��'�'��g�6�6�6�6�6��� 1�2�
�
�
�� �
0�
0�
0�0��2�2�#I�%(�#*�4�4������
#�$5�6�����$�0�0�0��L�"?�+/�0�0�0�0�0�0�0����������0�0�0�0�0�0�����
0���sE�!�1A�A�A2�2C0�B(�'C+�(1C�C+�C�C+�+C0c�N�	|js|j�|��dSdSrO)�
_cancelledr�rA�r�rs  r�
_add_callbackzBaseEventLoop._add_callback4s6��%�� �	'��K���v�&�&�&�&�&�	'�	'r c�Z�	|�|��|���dSrO)r�r:r�s  r�_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafe9s1��D����6�"�"�"��������r c�:�	|jr|xjdz
c_dSdSrp)r�r�r�s  r�_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelled>s4��A���	-��'�'�1�,�'�'�'�'�	-�	-r c���	t|j��}|tkrf|j|ztkrSg}|jD]&}|jrd|_�|�|���'tj|��||_d|_nb|jr[|jdjrI|xjdzc_tj	|j��}d|_|jr|jdj�Id}|j
s|jrd}nQ|jrJ|jdj}ttd||���z
��t ��}|j�|��}|�|��d}|���|jz}|jrZ|jd}|j|krnAtj	|j��}d|_|j
�|��|j�Zt|j
��}t+|��D]�}	|j
���}|jr�#|jr�	||_|���}
|���|���|
z
}||jkr#t7jdt;|��|��d|_��#d|_wxYw|�����d}dS)NFrrzExecuting %s took %.3f seconds)rWr��_MIN_SCHEDULED_TIMER_HANDLESr��%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr�rAr��heapify�heappopr�r��_whenr��maxr��MAXIMUM_SELECT_TIMEOUT�	_selector�selectr=r��range�popleftrwr��_runr�rrer)r��sched_count�
new_scheduledr�timeoutr�r<�end_time�ntodo�ir�r�s            rr}zBaseEventLoop._run_onceCs��	��$�/�*�*���6�6�6��'�+�5�5�
6�
6��M��/�
1�
1���$�1�(-�F�%�%�!�(�(��0�0�0�0��M�-�(�(�(�+�D�O�*+�D�'�'��/�
*�d�o�a�&8�&C�
*��+�+�q�0�+�+���t��7�7��$)��!��/�
*�d�o�a�&8�&C�
*�
���;�	N�$�.�	N��G�G�
�_�	N��?�1�%�+�D��#�a���	�	���!3�4�4�6L�M�M�G��^�*�*�7�3�3�
����Z�(�(�(��
��9�9�;�;��!7�7���o�	'��_�Q�'�F��|�x�'�'���]�4�?�3�3�F� %�F���K���v�&�&�&�
�o�	'��D�K� � ���u���	�	�A��[�(�(�*�*�F�� �
���{�
�	0�+1�D�(������B��K�K�M�M�M������r�)�B��T�8�8�8���'G�'5�f�'=�'=�r�C�C�C�,0�D�(�(��4�D�(�/�/�/�/����
�
�
�
����s
�	A4K�	Kc��t|��t|j��krdS|r7tj��|_tjtj��ntj|j��||_dSrO)rr�rx�#get_coroutine_origin_tracking_depthr��#set_coroutine_origin_tracking_depthr�DEBUG_STACK_DEPTH�r��enableds  rrvz,BaseEventLoop._set_coroutine_origin_tracking�s�����=�=�D��!H�I�I�I�I��F��	=��7�9�9�
�7��3��+�
-�
-�
-�
-�
�3��;�
=�
=�
=�3:��/�/�/r c��|jSrO)rwr�s rrzBaseEventLoop.get_debug�s
���{�r c�v�||_|���r|�|j|��dSdSrO)rwrrCrvr�s  rr�zBaseEventLoop.set_debug�sG������?�?���	T��%�%�d�&I�7�S�S�S�S�S�	T�	Tr rO)NNNr7)r)rN)FNN)Ur�r�r�r�r�r�rrrrr&r)r-r/r8r:r=r
r@rGrOr`rjrerrrr�rjr�rrKrLr�rr�r�r�r�r�r�r�rCr�r�r�r�r�r�r�r�r�r�rrr rrr-rSr*r9rrVr>�
AI_PASSIVErprrrvryr|r"r#r�r�r�r�r�r\r�r�r�r}rvrr�rPr rrr�s�������/�/�/�<
�
�
�)�)�)�)-�d������*%�%�%�"�"�"�"�%)�$�"�"�"�"�"�9=�"� �$��t�"&�!%�!%�
"�"�"�"�"�CG�"�"�"�"�
@D�(,�"�"�"�"�
AE�)-�"�"�"�"�04�"�"�"�"�"�"�"�"�"�"�7�7�7�D�D�D�G�G�G�
"�"�"����2���D�D�D�K�K�K�4�4�4�0$�$�$�L���*�*�*�.���%�M�����-�-�-� � � �:>������06:������$26������&%�%�%����(�(�(�"=A�	�	�	�	�	�5�5�5� *�*�*�
���2"#��!�1�H�H�H�H�H�7�7�7�7�
A�(,�
A�
A�
A�
A�
A�.�.�.�/�/�/�4���**.�*.�*.�*.�Z59�G#����1�4��T�"&�!%�!%�$�G#�G#�G#�G#�G#�V*/�"&�!%�	#�#�#�#�8-<�#'�-<�-<�-<�-<�-<�^1�1�1�"�"�"�4%*�(,�.2�-1�	.+�.+�.+�.+�.+�bEI�D#�./�q��26�7;�$�	D#�D#�D#�D#�D#�N'(�f�.@�%&�a�
D�
D�
D�
D�
D����59�I��#��#������"&�!%��I�I�I�I�I�Z�"&�!%�	#�#�#�#�#�<#�#�#� #�#�#� %�%�%�&0�_�&0�o�&0�o�27�%)�1�(,�T��
"#�"#�"#�"#�"#�J%/�O�J�O�%/�_��$)�1�'+�D�t�	 #� #� #� #� #�D'�'�'�
*�*�*�"0>�0>�0>�d70�70�70�r'�'�'�
���
-�-�-�
N�N�N�`
:�
:�
:����T�T�T�T�Tr r)rr)r)6rT�collections.abc�concurrent.futuresr�r�rr�rYrBr*r@r"rcr�r�rxrKr�rt�ImportErrorr4rrrrrr	r
rrr
r�logr�__all__r�r�r)r@r�rr&r1rLrcrmrqrv�Protocolrx�AbstractServerr�AbstractEventLooprrPr r�<module>r�sh��
�����������������������������	�	�	�	�
�
�
�
���������������������
�
�
�
�����������J�J�J�J������
�C�C�C�����������������������������������������������������������������������������$��
 #��),�%�
�G�F�J�'�'�	�#��������J�J�J�8�8�8�8�v����,"�"�"��7�6�=�!�!�
�G�G�G�G�
�
�
�>�>�>�
A)�A)�A)�A)�A)�	� 2�A)�A)�A)�Hn�n�n�n�n�V�
"�n�n�n�beT�eT�eT�eT�eT�F�,�eT�eT�eT�eT�eTs�A�A�A