HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/asyncio/__pycache__/base_events.cpython-312.opt-2.pyc
�

�h�e�/��0�	ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZ	ddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	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�dej`�Z1Gd �d!ejd�Z3Gd"�d#ejh�Z5y#e$rdZY��wxYw)&�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/python312/lib64/python3.12/asyncio/base_events.py�_format_handlerGs=��	�	�	�B��'�"�j�$�/����<��B�K�K� � ��6�{��c�h�|tjk(ry|tjk(ryt|�S)Nz<pipe>z<stdout>)�
subprocess�PIPE�STDOUTr)�fds r�_format_piper&Ps+��	�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_reuseportr1Ys`���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�decoder3r.)	�host�port�family�type�proto�flowinfo�scopeid�afs�afs	         r�_ipaddr_inforLds����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������
�]�	
��s�)
�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�1�3���1���a����,�,�*,���'��F�#�*�*�4�0�	1�
�.�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�yrO)�	cancelled�	exceptionr�
SystemExit�KeyboardInterruptr�	_get_loop�stop)�fut�excs  r�_run_until_complete_cbrm�sB���=�=�?��m�m�o���c�J�(9�:�;�
����c����!r �TCP_NODELAYc�4�|jtjtjhvrl|jtj
k(rN|jtjk(r0|jtjtjd�yyyy�Nr)
rEr*r?rrFr9rGr7r,rnr/s r�_set_nodelayrq�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��yrOrPr/s rrqrq�s��r c�\�t�&t|tj�rtd��yy)Nz"Socket cannot be of type SSLSocket)�sslr�	SSLSocketr=r/s r�_check_ssl_socketrv�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�rks  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�rls  rr�z)_SendfileFallbackProtocol.connection_lost�s[��� � �,��{��%�%�3�3�#�$B�C�E��%�%�3�3�C�8����#�#�C�(r c�p�|j�y|jjj�|_yrO)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�wrO)	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�rPr rrxrx�s3��)��O�	)�F�
%�F�F�
)r rxc�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_yrp)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��&yrO)r��doner�)r��waiters�waiters   rr�zServer._wakeup0s8���-�-����
��	(�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�r0s  rr�zServer._start_serving7su���=�=����
��M�M�	,�D��K�K��
�
�&��J�J�%�%��&�&��d�.?�.?��d�m�m�T�%@�%@��*�*�
,�	,r c��|jSrO)r�r�s r�get_loopzServer.get_loopBs���z�z�r c��|jSrO)r�r�s r�
is_servingzServer.is_servingEs���}�}�r c�T�|j�ytd�|jD��S)NrPc3�FK�|]}tj|����y�wrO)r�TransportSocket)rQ�ss  rrSz!Server.sockets.<locals>.<genexpr>Ls����F�1�V�+�+�A�.�F�s�!)r��tupler�s rr�zServer.socketsHs$���=�=� ���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�r0s   r�closezServer.closeNs����-�-���?����
��	+�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_servingas%���������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_forevergs������$�$�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��wrO)r�r�r�rA)r�r�s  rr�zServer.wait_closed|sE����	�(�=�=� �����)�)�+���
�
���V�$����s�A	A�A�ArO)r�r�r�r�r�r�r�r�r�r�r��propertyr�r�r�r�r�rPr 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�	_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�!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�rr	����r	)�
_check_closedr�rr�_source_traceback�_set_task_name)r��cororr	�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��	|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_transports��*�!�!r c	��K�	t��wrOr)
r�r�args�shell�stdin�stdout�stderr�bufsizer�kwargss
          r�_make_subprocess_transportz(BaseEventLoop._make_subprocess_transports����	+�!�!�s�
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��y)NzEvent loop is closed)r�r�r�s rr
zBaseEventLoop._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��yyrO)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��addrEs  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 )�messagerf�asyncgen)r��lenr�rV�clearr�gatherrD�zipr�	Exception�call_exception_handler)r��
closing_agens�ag�results�resultrFs      r�shutdown_asyncgensz BaseEventLoop.shutdown_asyncgens0s�����:�*.��'��4�?�?�#�
��T�_�_�-�
����������$1�
2�b�b�i�i�k�
2�$�"�$�$�� ���7�	�L�F�D��&�)�,��+�+�"9�9=�� B�!'� $�	-��	��3�$�s$�A!C�#C�:
C�C�&C�,!Cc��K�	d|_|j�y|j�}tj|j
|f��}|j
�	|�d{���|j|�|j�r=tjd|�d�td��|jjd��yy7�c#|j|�wxYw�w)	NT)�targetr1z:The executor did not finishing joining its threads within z	 seconds.�)�
stacklevelF��wait)
rr�r��	threading�Thread�_do_shutdown�start�join�is_aliverKrL�RuntimeWarning�shutdown)r��timeout�future�threads    r�shutdown_default_executorz'BaseEventLoop.shutdown_default_executorIs�����	�*.��&��!�!�)���#�#�%���!�!��):�):�&��K������	!��L�L��K�K�� ��?�?���M�M�3�3:�)�9�F�+��
;�
�"�"�+�+��+�7�	�	
���K�K�� �s1�AC�C� C�!C�%AC�C�C�Cc�&�	|jjd��|j�s|j|jd�yy#t
$r;}|j�s!|j|j|�Yd}~yYd}~yd}~wwxYw)NTrc)r�rlrrCr�rXr�)r�rn�exs   rrgzBaseEventLoop._do_shutdownas~��	D��"�"�+�+��+�6��>�>�#��)�)�&�*;�*;�T�B�$���	D��>�>�#��)�)�&�*>�*>��C�C�$��	D�s�AA�	B�,B�Bc�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_runningjs>���?�?���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)r
ru�_set_coroutine_origin_tracking�_debug�sys�get_asyncgen_hooksre�	get_identr��set_asyncgen_hooksrOrGr�_set_running_loop�	_run_oncer�)r��old_agen_hookss  r�run_foreverzBaseEventLoop.run_foreverqs��)����������+�+�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.)r
rur�isfuturer�
ensure_future�_log_destroy_pending�add_done_callbackrmr�r�rerf�remove_done_callbackr�r])r�rn�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 rrjzBaseEventLoop.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 %rTFrc)rr�r�rzr�debugr�rUr�rr�rl�r��executors  rr�zBaseEventLoop.close�s���	��?�?���B�C�C��<�<���;�;��L�L��T�*����������������)-��&��)�)����%)�D�"����5��)� r c��	|jSrO)r�r�s rrzBaseEventLoop.is_closed�s��8��|�|�r c��|j�s4|d|��t|��|j�s|j�yyy)Nzunclosed event loop rI)rrMrr�)r��_warns  r�__del__zBaseEventLoop.__del__�s=���~�~���(���1�?�4�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|j�|z|g|��d|i�}|jr
|jd=|S)Nzdelay must not be Noner	r)r=�call_atr�r)r��delay�callbackr	r1�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�rT)r=r
rz�
_check_thread�_check_callbackr�TimerHandler�heapq�heappushr�)r��whenr�r	r1r�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)r
rzr�r��
_call_soonr�r�r�r	r1rs     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�rA)r�r�r1r	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�rer}r�)r��	thread_ids  rr�zBaseEventLoop._check_thread3sG��	��?�?�"���'�'�)�	�����'��'�(�
(�(r c���	|j�|jr|j|d�|j|||�}|jr
|jd=|j�|S)NrCr)r
rzr�r�rr:r�s     rrCz"BaseEventLoop.call_soon_threadsafeDsc��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)
r
rzr�r�r@�
concurrentr�ThreadPoolExecutor�wrap_future�submit)r�r��funcr1s    rr�zBaseEventLoop.run_in_executorOs��������;�;�� � ��'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_executor_s,���(�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: )	rArirr�r�r*�getaddrinfor��info)r�rCrDrErFrG�flags�msg�t0�addrinfo�dts           r�_getaddrinfo_debugz BaseEventLoop._getaddrinfo_debugds����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�rErFrGr�c
��K�|jr
|j}ntj}|j	d|||||||��d{���S7��wrO)rzr�r*r�r�)r�rCrDrErFrGr��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��wrO)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)	rz�
gettimeoutr+rv�_check_sendfile_params�_sock_sendfile_nativer�SendfileNotAvailableError�_sock_sendfile_fallback)r�r0�file�offset�countr�rls       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�r0r�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�r0r�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+rFr*r9rr<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$rQ}
d|�d|
j
j
���}t	|
j|�}
|j|
�Yd}
~
��d}
~
wwxYw7�g#t$r)}
|j|
�|
�|
j��d}
~
w|
�|
j��xYw#dx}}wxYw�w)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�D����U�#��+�/?�Y�+�G�Q��1�e��&�(� �
2��	�	�%�(��
Y� %�+�/�/�1�1�%�(O��y�PV�&W�X�X��#�#�D�'�2�2�2��*.�-�J���3#�2�'�',�i�r�"�|�|�1�1�3�4�6��
&�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%)rtrErGr�r0�
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�rErFrGr�r��!getaddrinfo() returned empty listc3�b�K�|]&}tj�j�|�����(y�wrO)�	functools�partialr�)rQr�r�laddr_infosr�s  ���rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>Us4�����,�!��&�&�t�'9�'9�'1�8�[�J�,�s�,/rzcreate_connection failedrc3�:�K�|]}t|��k(���y�wrO�r)rQrl�models  �rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>ds�����G�S�s�3�x�5�0�G�s�zMultiple exceptions: {}r�c3�2K�|]}t|����y�wrOr
)rQrls  rrSz2BaseEventLoop.create_connection.<locals>.<genexpr>is����%E�3�c�#�h�%E�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+rv�_ensure_resolvedr*r9r.rcr�r�staggered_race�ExceptionGrouprTr�allr�rirF�_create_connection_transportrz�get_extra_inforr�)r�r�rCrDrtrErGr�r0r�r!r�r�r�rr�infosr�r��subrlr�rrrrs`                      @@@r�create_connectionzBaseEventLoop.create_connection�st�����
	��&�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�c�3�G�C�c�G�c�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&rr�)r�r0r�rtr!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�rls        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�rxr)r�r�r�r�r��write)r�r�r�r�r�r�r�r�rGr�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")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�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)rErGr��
reuse_port�allow_broadcastr0c	��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_addrrErGr�r2r3r�c3�6K�|]\}}|s�	|�d|�����y�w)�=NrP)rQ�k�vs   rrSz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>1s ����$N�D�A�q�A��s�!�A�3�Z�$N�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: %rrraz2-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))'rFr*r9r+�dictri�itemsr�r)r<rrr=�stat�S_ISSOCK�os�st_mode�remove�FileNotFoundErrorr.r�errorr�rTrr:r1r,r-�SO_BROADCASTr�r�r�rAr�r)rzr�r�) r�r�r�r5rErGr�r2r3r0�opts�problems�r_addr�addr_pairs_infor`�err�
addr_infos�idxr�famr��pror(�key�	addr_pairr�
local_address�remote_addressrlrr�r�s                                 r�create_datagram_endpointz&BaseEventLoop.create_datagram_endpoints�����
	*����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�'�(<�=�=�>��*�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�	;�;�&<F�;K�;K�;M�#E�)7��i�'�I�a�L�,@�(�Y�q�\�-A��)�$�#E��#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�!/���;
$�>!��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)Nrar�)rLr�)
r�r(rErFrGr�r�rCrDr�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)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�1C�27�d�,�D�D����L���0E�F�G�G���D�s�*A�A�Ar)
rEr�r0r�rt�
reuse_addressr2r�r�r�c
	��FK�	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]}|jU��n;|�td��|jVt(jXk7rtd|����|g}|D]}|j[d	��t]|||||||�}|
r-|j_�tj`d��d{���|j,rt/jbd|�|Scc}w7��	#t(j*$r*|j,rt/j0d
|||d��Y��wxYw#tH$r�}d|�d|jJjM���}|jNtNjPk(rG|jS�|jU�|j,rt/j0|�Yd}~���tI|jN|�d�d}~wwxYwcc}w#|s|D]}|jU��wwxYw7��A�w)Nz*ssl argument must be an SSLContext or Nonerrr�posix�cygwinr4)rEr�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)2rrr=r+rvrBrr{�platformrrT�abc�IterablerXrrV�setrYrZr[r*rFrzr�warningrAr,r-�SO_REUSEADDRr1r@rr)r_�IPV6_V6ONLYr�r.r�r�r��
EADDRNOTAVAILr�r�rFr9r�rr�r�r�)r�r�rCrDrEr�r0r�rtrYr2r�r�r�r��hosts�fsr�	completed�resrK�socktyperG�	canonname�sarLr�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�'� ��{���'?�'?�@������$�%���1�1�$��V�8=�2�?�%�B�%� �,�,��+�+�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�l�l�&8�&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?�O:
�*O?�5B(P!�P�.P!�9M�O?�
M�O?�	O7�A>O2�O?�O2�2O7�7O?�?P�P!)rtr�r�c	��rK�|jtjk7rtd|����|�
|std��|�
|std��|�t	|�|j|||dd||���d{���\}}|jr)|jd�}tjd|||�||fS7�@�w)	Nrrrr4T)r r�r�r*z%r handled: (%r, %r))
rFr*r9r+rvrrzrrr�)r�r�r0rtr�r�r�rs        r�connect_accepted_socketz%BaseEventLoop.connect_accepted_socketDs�����
�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�rzrr��fileno�r�r�r,rr�r�s      r�connect_read_pipezBaseEventLoop.connect_read_pipebs�����#�%���#�#�%���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�r/r�rzrr�rtrus      r�connect_write_pipez BaseEventLoop.connect_write_pipers�����#�%���#�#�%���3�3�D�(�F�K�	�	��L�L�
�;�;��L�L�<�����	�8�
=��(�"�"�
��	��O�O���rwc�r�|g}|�|jdt|����|�1|tjk(r|jdt|����n>|�|jdt|����|�|jdt|����t	j
dj
|��y)Nzstdin=zstdout=stderr=zstdout=zstderr=� )rAr&r"r$rr�ri)r�r�r3r4r5r�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 )	r3r4r5�universal_newlinesr2r6�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+rzr|r8rr�)r�r��cmdr3r4r5r}r2r6r~rr�r7r�	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+rzr|r8rr�)r�r��programr3r4r5r}r2r6r~rr�r1r7�
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��	|jSrO)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)NrRz!Unhandled exception in event looprfF�source_traceback�handle_traceback>rRrfr4z+Object created at (most recent call last):
z+Handle created at (most recent call last):
r��
r])�getrF�
__traceback__r�r�sortedri�	traceback�format_list�rstriprrArrF)	r�r	rRrfr^�	log_linesrQ�value�tbs	         r�default_exception_handlerz'BaseEventLoop.default_exception_handler�se��
	��+�+�i�(���9�G��K�K��,�	�� ��Y���I�4K�4K�L�H��H��g�-��$�$�0��$�$�6�6��$�$�6�6�
�&�'��I�	��'�?�	0�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�.�/�	0� 	���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]rrnr�get_context�runz$Unhandled error in exception handler)rRrfr	zeException in default exception handler while handling an unexpected error in custom exception handler)r�r�rgrhr,rrFr�r)r�r�)r�r	�ctx�thingrls     rrYz$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|�yyrO)�
_cancelledr�rA�r�rs  r�
_add_callbackzBaseEventLoop._add_callbackes%��%�� � ��K�K���v�&�!r c�H�	|j|�|j�yrO)r�r:r�s  r�_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafejs��D����6�"����r c�J�	|jr|xjdz
c_yyrp)r�r�r�s  r�_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelledos$��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)rTr��_MIN_SCHEDULED_TIMER_HANDLESr��%_MIN_CANCELLED_TIMER_HANDLES_FRACTIONr�rAr��heapify�heappopr�r��_whenr��maxr��MAXIMUM_SELECT_TIMEOUT�	_selector�selectr=r��range�popleftrzr��_runr�rrer)r��sched_count�
new_scheduledrrmr�r<�end_time�ntodo�ir�r�s            rr�zBaseEventLoop._run_oncets���	��$�/�/�*���6�6��'�'�+�5�5�
6��M��/�/�
1���$�$�(-�F�%�!�(�(��0�	
1�
�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�||_yrO)rr�r{�#get_coroutine_origin_tracking_depthr��#set_coroutine_origin_tracking_depthr�DEBUG_STACK_DEPTH�r��enableds  rryz,BaseEventLoop._set_coroutine_origin_tracking�sw����=�D��!H�!H�I�I����7�7�9�
�7��3�3��+�+�
-�3:��/�
�3�3��;�;�
=�3:��/r c��|jSrO)rzr�s rrzBaseEventLoop.get_debug�s���{�{�r c�l�||_|j�r|j|j|�yyrO)rzrrCryr�s  rr�zBaseEventLoop.set_debug�s.������?�?���%�%�d�&I�&I�7�S�r rO)NNNr;)r)rN)FNN)Ur�r�r�r�r�r�rrrrr&r)r-r/r8r:r=r
r@rGrOr^rprgrur�r�rjr�rrKrLr�rr�r�r�r�r�r�r�rCr�r�r�r�r�r�r�r�r�r�rrr$r"r#r1rUr*r9rrXr>�
AI_PASSIVErprrrvryr|r"r#r�r�r�r�r�rYr�r�r�r�ryrr�rPr rrr�s��/�<
�)�)-�d��*%�"�"�%)�$�"�9=�"� �$��t�"&�!%�!%�
"�CG�"�
@D�(,�"�
AE�)-�"�04�"�"�"�7�D�G�
"��28�0D�K�4�0$�L�*�.�%�M�M��-� �:>��06:��$26��&%��(�"=A�	�5� *�
�2"#��!�1�H�7�
A�(,�
A�.�/�4�**.�Z59�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)6rT�collections.abc�concurrent.futuresr�r�r	r�rYrBr*r@r"rer�r�r{rKr�rt�ImportErrorr4rrrrrr	r
rrr
r�logr�__all__r�r�r)r@r�rr&r1rLrcrmrqrv�Protocolrx�AbstractServerr�AbstractEventLooprrPr r�<module>r�s-��
��������	�
������
�����������������$��
 #��),�%�
�F�J�'�	�#����J�8�v�,"��6�=�!�G�
�>�
A)�	� 2� 2�A)�HB�V�
"�
"�B�JBT�F�,�,�BT��i��
�C��s�D�D�D