%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/asyncio/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/asyncio/__pycache__/base_events.cpython-312.pyc

�

���f�0��>�dZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlZddlZ	ddlZddlmZddlmZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlm Z ddlm!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�Z0nd�Z0d�Z1Gd �d!ejd�Z3Gd"�d#ejh�Z5Gd$�d%ejl�Z7y#e$rdZY��wxYw)(a�Base implementation of event loop.

The event loop can be broken up into a multiplexer (the part
responsible for notifying us of I/O events) and the event loop proper,
which wraps a multiplexer with functionality for scheduling callbacks,
immediately or at a given time in the future.

Whenever a public API takes a callback, subsequent positional
arguments will be passed to the callback if/when it is called.  This
avoids the proliferation of trivial lambdas implementing closures.
Keyword arguments for the callback are not supported; this is a
conscious design decision, leaving the door open for keyword arguments
to modify the meaning of the API call itself.
�N�)�	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  �*/usr/lib/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)z-Interleave list of addrinfo tuples by family.rrNc3�$K�|]}|�|���
y�w�N�)�.0�as  r�	<genexpr>z(_interleave_addrinfos.<locals>.<genexpr>�s������
�]�	
��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���&�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�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�J�|j�J�|xjdz
c_yrq)r�r�r�s r�_attachzServer._attach's#���}�}�(�(�(����a��r!c��|jdkDsJ�|xjdzc_|jdk(r|j�|j�yyy)Nrr)r�r��_wakeupr�s r�_detachzServer._detach+sO���!�!�A�%�%�%����a�������"�t�}�}�'<��L�L�N�(=�"r!c�|�|j}d|_|D]$}|j�r�|jd��&yrP)r��doner�)r��waiters�waiters   rr�zServer._wakeup1s8���-�-����
��	(�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_serving8su���=�=����
��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�.�F�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��w)a�Wait until server is closed and all connections are dropped.

        - If the server is not closed, wait.
        - If it is closed, but there are still active connections, wait.

        Anyone waiting here will be unblocked once both conditions
        (server is closed and all connections have been dropped)
        have become true, in either order.

        Historical note: In 3.11 and before, this was broken, returning
        immediately if the server was already closed, even if there
        were still active connections. An attempted fix in 3.12.0 was
        still broken, returning immediately if the server was still
        open and there were no active connections. Hopefully in 3.12.1
        we have it right.
        N)r�r�r�rB)r�r�s  rr�zServer.wait_closed}s@����*�=�=� �����)�)�+���
�
���V�$����s�AA�
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�.�tj|��S)z,Create a Future object attached to the loop.�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)zDSchedule a coroutine object.

        Return a task object.
        )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�B�|�t|�std��||_y)awSet a task factory that will be used by loop.create_task().

        If factory is None the default task factory will be set.

        If factory is a callable, it should have a signature matching
        '(loop, coro)', where 'loop' will be a reference to the active
        event loop, 'coro' will be a coroutine object.  The callable
        must return a Future.
        Nz'task factory must be a callable or None)�callabler>r�)r��factorys  r�set_task_factoryzBaseEventLoop.set_task_factory�s%����x��'8��E�F�F�$��r!c��|jS)z<Return a task factory, or None if the default one is in use.)r�r�s r�get_task_factoryzBaseEventLoop.get_task_factory�s���!�!�!r!)�extra�serverc��t�)zCreate socket transport.��NotImplementedError)r�r1�protocolr�rrs      r�_make_socket_transportz$BaseEventLoop._make_socket_transport��
��"�!r!FT)�server_side�server_hostnamerrr�r��call_connection_madec��t�)zCreate SSL transport.r)r��rawsockr�
sslcontextr�r!r"rrr�r�r#s            r�_make_ssl_transportz!BaseEventLoop._make_ssl_transport�s
��"�!r!c��t�)zCreate datagram transport.r)r�r1r�addressr�rs      r�_make_datagram_transportz&BaseEventLoop._make_datagram_transport�r r!c��t�)zCreate read pipe transport.r�r��piperr�rs     r�_make_read_pipe_transportz'BaseEventLoop._make_read_pipe_transport�r r!c��t�)zCreate write pipe transport.rr,s     r�_make_write_pipe_transportz(BaseEventLoop._make_write_pipe_transportr r!c	��K�t��w)zCreate subprocess transport.r)
r�r�args�shell�stdin�stdout�stderr�bufsizer�kwargss
          r�_make_subprocess_transportz(BaseEventLoop._make_subprocess_transports����"�!�s�	c��t�)z�Write a byte to self-pipe, to wake up the event loop.

        This may be called from a different thread.

        The subclass is responsible for implementing the self-pipe.
        rr�s r�_write_to_selfzBaseEventLoop._write_to_selfs
��"�!r!c��t�)zProcess selector events.r)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��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)z,Shutdown all active asynchronous generators.TN�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�b�b�i�i�k�
2�$�"�$�$�� ���7�	�L�F�D��&�)�,��+�+�"9�9=�� B�!'� $�	-��	��3�$�s$�A C
�"C�9
C
�C�&C
�+!C
c��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)
aSchedule the shutdown of the default executor.

        The timeout parameter specifies the amount of time the executor will
        be given to finish joining. The default value is None, which means
        that the executor will be given an unlimited amount of time.
        TN)�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�
�
����
�
�
�K�K�M�
����
��
�
�
���	8��M�M�0�07�y�	�C�(�Q�
8�
�"�"�+�+��+�7�		8�s��AD	�B>�3B#�4B>�7B)�=B%�>B)�B>�
B'�B>�D	�#B>�%B)�'B>�)B;�/B2�0B;�7B>�>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)zRun until stop() is called.)�	firstiter�	finalizerFN)r
rw�_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)a\Run until the Future is done.

        If the argument is a coroutine, it is wrapped in a Task.

        WARNING: It would be disastrous to call run_until_complete()
        with the same coroutine twice -- it would wrap it in two
        different Tasks and that can't be good.

        Return the Future's result, or raise its exception.
        rFz+Event loop stopped before Future completed.)r
rwr�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>�>5C3�3C6�6D
c��d|_y)z�Stop running the event loop.

        Every callback already scheduled will still run.  This simply informs
        run_forever to stop looping after a complete iteration.
        TN)r�r�s rrkzBaseEventLoop.stop�s����r!c�l�|j�rtd��|jry|jrt	j
d|�d|_|jj�|jj�d|_	|j}|�d|_
|jd��yy)z�Close the event loop.

        This clears the queues and shuts down the executor,
        but does not wait for the executor to finish.

        The event loop must not be running.
        z!Cannot close a running event loopNzClose %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��|jS)z*Returns True if the event loop was closed.)r�r�s rrzBaseEventLoop.is_closed�s���|�|�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��|jduS)z*Returns True if the event loop is running.N)r�r�s rrzBaseEventLoop.is_running�s�����t�+�,r!c�*�tj�S)z�Return the time according to the event loop's clock.

        This is a float expressed in seconds since an epoch, but the
        epoch, precision, accuracy and drift are unspecified and may
        differ per event loop.
        )r�r�r�s rr�zBaseEventLoop.time�s���~�~��r!rc��|�td��|j|j�|z|g|��d|i�}|jr
|jd=|S)a;Arrange for a callback to be called at a given time.

        Return a Handle: an opaque object with a cancel() method that
        can be used to cancel the call.

        The delay can be an int or float, expressed in seconds.  It is
        always relative to the current time.

        Each callback will be called exactly once.  If two callbacks
        are scheduled for exactly the same time, it is undefined which
        will be called first.

        Any positional arguments after the callback will be passed to
        the callback when it is called.
        zdelay must not be Noner	r)r>�call_atr�r)r��delay�callbackr	r2�timers      r�
call_laterzBaseEventLoop.call_later�s_�� �=��4�5�5�����T�Y�Y�[�5�0�(�.�T�.�%,�.���"�"��'�'��+��r!c�N�|�td��|j�|jr"|j�|j	|d�tj|||||�}|jr
|jd=tj|j|�d|_
|S)z|Like call_later(), but uses an absolute time.

        Absolute time corresponds to the event loop's time() method.
        zwhen cannot be Noner�rT)r>r
r|�
_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)aTArrange for a callback to be called as soon as possible.

        This operates as a FIFO queue: callbacks are called in the
        order in which they are registered.  Each callback will be
        called exactly once.

        Any positional arguments after the callback will be passed to
        the callback when it is called.
        �	call_soonr)r
r|r�r��
_call_soonr�r�r�r	r2rs     rr�zBaseEventLoop.call_soonsa��	
�����;�;���� �� � ��;�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�z�|j�ytj�}||jk7rtd��y)aoCheck that the current thread is the thread running the event loop.

        Non-thread-safe methods of this class make this assumption and will
        likely behave incorrectly when the assumption is violated.

        Should only be called when (self._debug == True).  The caller is
        responsible for checking this condition for performance reasons.
        NzMNon-thread-safe operation invoked on an event loop other than the current one)r�rfrr�)r��	thread_ids  rr�zBaseEventLoop._check_thread5sB���?�?�"���'�'�)�	�����'��'�(�
(�(r!c���|j�|jr|j|d�|j|||�}|jr
|jd=|j�|S)z"Like call_soon(), but thread-safe.rDr)r
r|r�r�rr;r�s     rrDz"BaseEventLoop.call_soon_threadsafeFs`�������;�;�� � ��+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
r|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$rQ}
d|�d|
j
j
���}t	|
j|�}
|j|
�Yd}
~
��d}
~
wwxYw7�g#t$r)}
|j|
�|
�|
j��d}
~
w|
�|
j��xYw#dx}}wxYw�w)z$Create, bind and connect one socket.N�rFrGrHF�*error while attempting to bind on address �: z&no matching local address with family=z found)rBr+�setblocking�bindr/�strerror�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������
��
���-�(�+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�B4�09D�)D�*D�/E$�4	D�=AD	�D�	D�D�	E�$E�E�E�E!�!E$)rurFrHr�r1�
local_addrr"r�r��happy_eyeballs_delay�
interleave�
all_errorsc��D����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)a�Connect to a TCP server.

        Create a streaming transport connection to a given internet host and
        port: socket family AF_INET or socket.AF_INET6 depending on host (or
        family if specified), socket type SOCK_STREAM. protocol_factory must be
        a callable returning a protocol instance.

        This method is a coroutine which will try to establish the connection
        in the background.  When successful, the coroutine returns a
        (transport, protocol) pair.
        Nz+server_hostname is only meaningful with sslz:You must set server_hostname when using ssl without a 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>Ws4�����,�!��&�&�t�'9�'9�'1�8�[�J�,�s�,/rzcreate_connection failedrc3�:�K�|]}t|��k(���y�wrP�r)rRrm�models  �rrTz2BaseEventLoop.create_connection.<locals>.<genexpr>fs�����G�S�s�3�x�5�0�G�s�zMultiple exceptions: {}r�c3�2K�|]}t|����y�wrPr)rRrms  rrTz2BaseEventLoop.create_connection.<locals>.<genexpr>ks����%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,rw�_ensure_resolvedr+r:r/rdr�r�staggered_race�ExceptionGrouprUr�allr�rkrG�_create_connection_transportr|�get_extra_inforr�)r�r�rDrErurFrHr�r1rr"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�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 �I5�;J �I8�*J �>I>�I;�I>�*J �J�J �J�#J �(A8J� AJ �2J�3AJ �8J �;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�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)a�Send a file to transport.

        Return the total number of bytes which were sent.

        The method uses high-performance os.sendfile if available.

        file must be a regular file object opened in binary mode.

        offset tells from where to start reading the file. If specified,
        count is the total number of bytes to transmit as opposed to
        sending the file until EOF is reached. File position is updated on
        return or also in case of error in which case file.tell()
        can be used to figure out the number of bytes
        which were sent.

        fallback set to True makes asyncio to manually read and send
        the file when the platform does not support the sendfile syscall
        (e.g. Windows or SSL socket on Unix).

        Raise SendfileNotAvailableError if the system does not support
        sendfile syscall and fallback is False.
        zTransport is closing�_sendfile_compatiblez(sendfile is not supported for transport NzHfallback 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����0���!��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�BC9�
C�!C�"C�%(C9�
C7�C9�C�C4�'C/�*C9�/C4�4C9c��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��nK�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)	zzUpgrade transport to TLS.

        Return a new transport that *protocol* should start using
        immediately.
        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�s=�����;��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�CD5�C7�$C5�%C7�)D5�5C7�7;D2�2D5)rFrHr��
reuse_port�allow_broadcastr1c	��DK�|	��|	jtjk(rtd|	����|s|s
|s|s|s|s|rGt	|||||||��}
djd�|
j
�D��}td|�d���|	jd�d}�nb|s|s|d	k(rtd
��||fdff}
�n�ttd�r�|tjk(r�||fD] }|��t|t�r�td
��|rO|d	dvrH	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)zCreate datagram connection.Nz$A datagram socket was expected, got )r�remote_addrrFrHr�r4r5r�c3�6K�|]\}}|s�	|�d|�����y�w)�=NrQ)rR�k�vs   rrTz9BaseEventLoop.create_datagram_endpoint.<locals>.<genexpr>3s ����$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: %rrrbz2-tuple is expectedrr	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))'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�rr7rFrHr�r4r5r1�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�'�(<�=�=�>��*�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 �5P �AM6�P �/AP �N/�A
P �N2�'$P �B!N:�-N8�.N:�4A3P �(P
�-P�.P
�2P �6	N,�?P �N,�
N'�!P �'N,�,P �2P �8N:�:	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_addressr4r�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]}|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)a1Create a TCP server.

        The host parameter can be a string, in that case the TCP server is
        bound to host and port.

        The host parameter can also be a sequence of strings and in that case
        the TCP server is bound to all hosts of the sequence. If a host
        appears multiple times (possibly indirectly e.g. when hostnames
        resolve to the same IP address), the server is only bound once to that
        host.

        Return a Server object which can be used to stop the service.

        This method is a coroutine.
        z*ssl argument must be an SSLContext or NoneNrrr�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)2rrr>r,rwrDrr}�platformrrU�abc�IterablerZrrW�setrZr[r\r+rHr|r�warningrBr-r.�SO_REUSEADDRr2rArr*ra�IPV6_V6ONLYr�r/r�r�r��
EADDRNOTAVAILr�r�rGr:r�rr�r�r�)r�r�rDrErFr�r1r�rur[r4r�r�r�r��hosts�fsr�	completed�resrL�socktyperH�	canonname�sarNr�r�rs                             r�
create_serverzBaseEventLoop.create_server�s����8�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 �1
O>�?L
�B'O>�>M
�O>�O9
�)O>�4B(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_socketFs�����
�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_pipeds�����#�%���#�#�%���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�rvrws      r�connect_write_pipez BaseEventLoop.connect_write_pipets�����#�%���#�#�%���3�3�D�(�F�K�	�	��L�L�
�;�;��L�L�<�����	�8�
=��(�"�"�
��	��O�O���ryc�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��cmdr4r5r6rr3r7r�r�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��programr4r5r6rr3r7r�r�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��|jS)zKReturn an exception handler, or None if the default one is in use.
        )r�r�s r�get_exception_handlerz#BaseEventLoop.get_exception_handler�s���&�&�&r!c�H�|�t|�std|����||_y)a�Set handler as the new event loop exception handler.

        If handler is None, the default exception handler will
        be set.

        If handler is a callable object, it should have a
        signature matching '(loop, context)', where 'loop'
        will be a reference to the active event loop, 'context'
        will be a dict object (see `call_exception_handler()`
        documentation for details about context).
        Nz+A callable object or None is expected, got )rr>r�)r��handlers  r�set_exception_handlerz#BaseEventLoop.set_exception_handler�s5����x��'8��#�#*�+�/�0�
0�")��r!c���|jd�}|sd}|jd�}|�t|�||jf}nd}d|vr;|j�/|jjr|jj|d<|g}t|�D]�}|dvr�||}|dk(r:d	j
tj|��}d
}||j�z
}nJ|dk(r:d	j
tj|��}d}||j�z
}nt|�}|j|�d|�����tjd
j
|�|��y)aEDefault exception handler.

        This is called when an exception occurs and no exception
        handler is set, and can be called by a custom exception
        handler that wants to defer to the default behavior.

        This default handler logs the error message and other
        context-dependent information.  In debug mode, a truncated
        stack trace is also appended showing where the given object
        (e.g. a handle or future or task) was created, if any.

        The context parameter has the same meaning as in
        `call_exception_handler()`.
        rSz!Unhandled exception in event looprgNF�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�rstriprrBrrH)	r�r	rSrgr`�	log_linesrS�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�	��'�?�	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dd��YnwxYwYd}~yYd}~yd}~wwxYw)
aDCall the current event loop's exception handler.

        The context argument is a dict containing the following keys:

        - 'message': Error message;
        - 'exception' (optional): Exception object;
        - 'future' (optional): Future instance;
        - 'task' (optional): Task instance;
        - 'handle' (optional): Handle instance;
        - 'protocol' (optional): Protocol instance;
        - 'transport' (optional): Transport instance;
        - 'socket' (optional): Socket instance;
        - 'asyncgen' (optional): Asynchronous generator that caused
                                 the exception.

        New keys maybe introduced in the future.

        Note: do not overload this method in an event loop subclass.
        For custom exception handling, use the
        `set_exception_handler()` method.
        Nz&Exception in default exception 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.rrHr�r*r�r�)r�r	�ctx�thingrms     rrZz$BaseEventLoop.call_exception_handlersq��,�"�"�*�	
,��.�.�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�B7�BC,�$C,�7/C)�(C)�,E�D�E�/E
�
E�E
�
E�Ec�T�|js|jj|�yy)zAdd a Handle to _ready.N)�
_cancelledr�rB�r�rs  r�
_add_callbackzBaseEventLoop._add_callbackgs"��� � ��K�K���v�&�!r!c�F�|j|�|j�y)z6Like _add_callback() but called from a signal handler.N)r�r;r�s  r�_add_callback_signalsafez&BaseEventLoop._add_callback_signalsafels�����6�"����r!c�H�|jr|xjdz
c_yy)z3Notification that a TimerHandle has been cancelled.rN)r�r�r�s  r�_timer_handle_cancelledz%BaseEventLoop._timer_handle_cancelledqs!������'�'�1�,�'�r!c�b�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)z�Run one full iteration of the event loop.

        This calls all currently ready callbacks, polls for I/O,
        schedules the resulting callbacks, and finally schedules
        'call_later' callbacks.
        FrrNzExecuting %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�rrgr )r��sched_count�
new_scheduledrrjr�r=�end_time�ntodo�ir�r�s            rr�zBaseEventLoop._run_oncevs����$�/�/�*���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�||_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�rrrrr'r*r.r0r9r;r>r
rArHrPr_rqrhrwr�r�rkr�rrLrMr�rr�r�r�r�r�r�r�rDr�r�r�r�r�r�r�r�r�r�rrr&r$r%r3rWr+r:rrZr?�
AI_PASSIVErrrtrxr{r~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�**.�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)8�__doc__rU�collections.abc�concurrent.futuresr�r�rr�rZrDr+rBr#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�JCT�F�,�,�CT��k��
�C��s�D�D�D

Zerion Mini Shell 1.0