AlkantarClanX12

Your IP : 3.145.61.199


Current Path : /opt/alt/python38/lib64/python3.8/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/asyncio/__pycache__/events.cpython-38.pyc

U

i�f4f�@s|dZdZddlZddlZddlZddlZddlZddlZddlm	Z	ddlm
Z
Gdd�d�ZGd	d
�d
e�ZGdd�d�Z
Gd
d�d�ZGdd�d�ZGdd�de�Zdae��ZGdd�dej�Ze�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Z d)d*�Z!eZ"eZ#eZ$eZ%zdd+l&mZmZmZmZWne'k
�rfYnXeZ(eZ)eZ*eZ+dS),z!Event loop and event loop policy.)�AbstractEventLoopPolicy�AbstractEventLoop�AbstractServer�Handle�TimerHandle�get_event_loop_policy�set_event_loop_policy�get_event_loop�set_event_loop�new_event_loop�get_child_watcher�set_child_watcher�_set_running_loop�get_running_loop�_get_running_loop�N�)�format_helpers)�
exceptionsc@sFeZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)rz1Object returned by callback registration methods.)�	_callback�_args�
_cancelled�_loop�_source_traceback�_repr�__weakref__�_contextNcCs\|dkrt��}||_||_||_||_d|_d|_|j��rRt	�
t�d��|_
nd|_
dS)NFr)�contextvarsZcopy_contextrrrrrr�	get_debugr�
extract_stack�sys�	_getframer)�self�callback�args�loop�context�r&�3/opt/alt/python38/lib64/python3.8/asyncio/events.py�__init__ s
�zHandle.__init__cCsl|jjg}|jr|�d�|jdk	r:|�t�|j|j��|jrh|jd}|�d|d�d|d���|S)N�	cancelled���zcreated at r�:r)	�	__class__�__name__r�appendrr�_format_callback_sourcerr)r!�info�framer&r&r'�
_repr_info/s


�
zHandle._repr_infocCs(|jdk	r|jS|��}d�d�|��S)Nz<{}>� )rr2�format�join)r!r0r&r&r'�__repr__;s
zHandle.__repr__cCs0|js,d|_|j��r t|�|_d|_d|_dS�NT)rrr�reprrrr�r!r&r&r'�cancelAs

z
Handle.cancelcCs|jS�N)rr9r&r&r'r)LszHandle.cancelledc
Cs�z|jj|jf|j��Wn|ttfk
r4�Yndtk
r�}zFt�|j|j�}d|��}|||d�}|j	rz|j	|d<|j
�|�W5d}~XYnXd}dS)NzException in callback )�messageZ	exception�handleZsource_traceback)r�runrr�
SystemExit�KeyboardInterrupt�
BaseExceptionrr/rr�call_exception_handler)r!�exc�cb�msgr%r&r&r'�_runOs$�
�
zHandle._run)N)r-�
__module__�__qualname__�__doc__�	__slots__r(r2r6r:r)rFr&r&r&r'rs
rcs�eZdZdZddgZd�fdd�	Z�fdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Z�ZS)rz7Object returned by timed callback registration methods.�
_scheduled�_whenNcs<|dk	st�t��||||�|jr,|jd=||_d|_dS)Nr*F)�AssertionError�superr(rrLrK)r!�whenr"r#r$r%�r,r&r'r(hszTimerHandle.__init__cs0t���}|jrdnd}|�|d|j���|S)N�rzwhen=)rNr2r�insertrL)r!r0�posrPr&r'r2ps
zTimerHandle._repr_infocCs
t|j�Sr;)�hashrLr9r&r&r'�__hash__vszTimerHandle.__hash__cCs|j|jkSr;�rL�r!�otherr&r&r'�__lt__yszTimerHandle.__lt__cCs|j|jkrdS|�|�Sr7�rL�__eq__rWr&r&r'�__le__|szTimerHandle.__le__cCs|j|jkSr;rVrWr&r&r'�__gt__�szTimerHandle.__gt__cCs|j|jkrdS|�|�Sr7rZrWr&r&r'�__ge__�szTimerHandle.__ge__cCs>t|t�r:|j|jko8|j|jko8|j|jko8|j|jkStSr;)�
isinstancerrLrrr�NotImplementedrWr&r&r'r[�s

�
�
�zTimerHandle.__eq__cCs|�|�}|tkrtS|Sr;)r[r`)r!rXZequalr&r&r'�__ne__�s
zTimerHandle.__ne__cs |js|j�|�t���dSr;)rr�_timer_handle_cancelledrNr:r9rPr&r'r:�szTimerHandle.cancelcCs|jS)z�Return a scheduled callback time.

        The time is an absolute timestamp, using the same time
        reference as loop.time().
        rVr9r&r&r'rO�szTimerHandle.when)N)r-rGrHrIrJr(r2rUrYr\r]r^r[rar:rO�
__classcell__r&r&rPr'rcsrc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)rz,Abstract server returned by create_server().cCst�dS)z5Stop serving.  This leaves existing connections open.N��NotImplementedErrorr9r&r&r'�close�szAbstractServer.closecCst�dS)z4Get the event loop the Server object is attached to.Nrdr9r&r&r'�get_loop�szAbstractServer.get_loopcCst�dS)z3Return True if the server is accepting connections.Nrdr9r&r&r'�
is_serving�szAbstractServer.is_servingc�st�dS)z�Start accepting connections.

        This method is idempotent, so it can be called when
        the server is already being serving.
        Nrdr9r&r&r'�
start_serving�szAbstractServer.start_servingc�st�dS)z�Start accepting connections until the coroutine is cancelled.

        The server is closed when the coroutine is cancelled.
        Nrdr9r&r&r'�
serve_forever�szAbstractServer.serve_foreverc�st�dS)z*Coroutine to wait until service is closed.Nrdr9r&r&r'�wait_closed�szAbstractServer.wait_closedc�s|Sr;r&r9r&r&r'�
__aenter__�szAbstractServer.__aenter__c�s|��|��IdHdSr;)rfrk)r!rCr&r&r'�	__aexit__�szAbstractServer.__aexit__N)r-rGrHrIrfrgrhrirjrkrlrmr&r&r&r'r�src@sVeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�dd�Zd d!�Zd"d#�Zd$d%�Zd&d&d&d&d'�d(d)�Zdud*d+�Zdvdd&d&d&ddddddd,�
d-d.�Zdwejejdd/ddddd0d1�	d2d3�Zdxd0d4�d5d6�Zd7ddd8�d9d:�Zdyddddd;�d<d=�Zdzdd/ddd0d>�d?d@�Zd{d&d&d&dddddA�dBdC�Z dDdE�Z!dFdG�Z"e#j$e#j$e#j$dH�dIdJ�Z%e#j$e#j$e#j$dH�dKdL�Z&dMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d|dd4�d_d`�Z0dadb�Z1dcdd�Z2dedf�Z3dgdh�Z4didj�Z5dkdl�Z6dmdn�Z7dodp�Z8dqdr�Z9dsdt�Z:dS)}rzAbstract event loop.cCst�dS)z*Run the event loop until stop() is called.Nrdr9r&r&r'�run_forever�szAbstractEventLoop.run_forevercCst�dS)zpRun the event loop until a Future is done.

        Return the Future's result, or raise its exception.
        Nrd)r!Zfuturer&r&r'�run_until_complete�sz$AbstractEventLoop.run_until_completecCst�dS)z�Stop the event loop as soon as reasonable.

        Exactly how soon that is may depend on the implementation, but
        no more I/O callbacks should be scheduled.
        Nrdr9r&r&r'�stop�szAbstractEventLoop.stopcCst�dS)z3Return whether the event loop is currently running.Nrdr9r&r&r'�
is_running�szAbstractEventLoop.is_runningcCst�dS)z*Returns True if the event loop was closed.Nrdr9r&r&r'�	is_closed�szAbstractEventLoop.is_closedcCst�dS)z�Close the loop.

        The loop should not be running.

        This is idempotent and irreversible.

        No other methods should be called after this one.
        Nrdr9r&r&r'rf�s	zAbstractEventLoop.closec�st�dS)z,Shutdown all active asynchronous generators.Nrdr9r&r&r'�shutdown_asyncgens�sz$AbstractEventLoop.shutdown_asyncgenscCst�dS)z3Notification that a TimerHandle has been cancelled.Nrd)r!r=r&r&r'rb�sz)AbstractEventLoop._timer_handle_cancelledcGs|jd|f|��S)Nr)�
call_later�r!r"r#r&r&r'�	call_soonszAbstractEventLoop.call_sooncGst�dSr;rd)r!Zdelayr"r#r&r&r'rtszAbstractEventLoop.call_latercGst�dSr;rd)r!rOr"r#r&r&r'�call_atszAbstractEventLoop.call_atcCst�dSr;rdr9r&r&r'�timeszAbstractEventLoop.timecCst�dSr;rdr9r&r&r'�
create_futureszAbstractEventLoop.create_futureN)�namecCst�dSr;rd)r!�cororzr&r&r'�create_taskszAbstractEventLoop.create_taskcGst�dSr;rdrur&r&r'�call_soon_threadsafesz&AbstractEventLoop.call_soon_threadsafecGst�dSr;rd)r!�executor�funcr#r&r&r'�run_in_executorsz!AbstractEventLoop.run_in_executorcCst�dSr;rd)r!r~r&r&r'�set_default_executorsz&AbstractEventLoop.set_default_executorr)�family�type�proto�flagsc�st�dSr;rd)r!�host�portr�r�r�r�r&r&r'�getaddrinfo#szAbstractEventLoop.getaddrinfoc�st�dSr;rd)r!Zsockaddrr�r&r&r'�getnameinfo'szAbstractEventLoop.getnameinfo)
�sslr�r�r��sock�
local_addr�server_hostname�ssl_handshake_timeout�happy_eyeballs_delay�
interleavec
�st�dSr;rd)r!�protocol_factoryr�r�r�r�r�r�r�r�r�r�r�r�r&r&r'�create_connection*sz#AbstractEventLoop.create_connection�dT)	r�r�r��backlogr��
reuse_address�
reuse_portr�ric	
�st�dS)adA coroutine which creates a TCP server bound to host and port.

        The return value is a Server object which can be used to stop
        the service.

        If host is an empty string or None all interfaces are assumed
        and a list of multiple sockets will be returned (most likely
        one for IPv4 and another one for IPv6). The host parameter can also be
        a sequence (e.g. list) of hosts to bind to.

        family can be set to either AF_INET or AF_INET6 to force the
        socket to use IPv4 or IPv6. If not set it will be determined
        from host (defaults to AF_UNSPEC).

        flags is a bitmask for getaddrinfo().

        sock can optionally be specified in order to use a preexisting
        socket object.

        backlog is the maximum number of queued connections passed to
        listen() (defaults to 100).

        ssl can be set to an SSLContext to enable SSL over the
        accepted connections.

        reuse_address tells the kernel to reuse a local socket in
        TIME_WAIT state, without waiting for its natural timeout to
        expire. If not specified will automatically be set to True on
        UNIX.

        reuse_port tells the kernel to allow this endpoint to be bound to
        the same port as other existing endpoints are bound to, so long as
        they all set this flag when being created. This option is not
        supported on Windows.

        ssl_handshake_timeout is the time in seconds that an SSL server
        will wait for completion of the SSL handshake before aborting the
        connection. Default is 60s.

        start_serving set to True (default) causes the created server
        to start accepting connections immediately.  When set to False,
        the user should await Server.start_serving() or Server.serve_forever()
        to make the server to start accepting connections.
        Nrd)
r!r�r�r�r�r�r�r�r�r�r�r�rir&r&r'�
create_server3s3zAbstractEventLoop.create_server)�fallbackc�st�dS)zRSend a file through a transport.

        Return an amount of sent bytes.
        Nrd)r!�	transport�file�offset�countr�r&r&r'�sendfilehszAbstractEventLoop.sendfileF)�server_sider�r�c�st�dS)z|Upgrade a transport to TLS.

        Return a new transport that *protocol* should start using
        immediately.
        Nrd)r!r�ZprotocolZ
sslcontextr�r�r�r&r&r'�	start_tlsps	zAbstractEventLoop.start_tls)r�r�r�r�c�st�dSr;rd)r!r��pathr�r�r�r�r&r&r'�create_unix_connection{sz(AbstractEventLoop.create_unix_connection)r�r�r�r�ric�st�dS)a�A coroutine which creates a UNIX Domain Socket server.

        The return value is a Server object, which can be used to stop
        the service.

        path is a str, representing a file systsem path to bind the
        server socket to.

        sock can optionally be specified in order to use a preexisting
        socket object.

        backlog is the maximum number of queued connections passed to
        listen() (defaults to 100).

        ssl can be set to an SSLContext to enable SSL over the
        accepted connections.

        ssl_handshake_timeout is the time in seconds that an SSL server
        will wait for the SSL handshake to complete (defaults to 60s).

        start_serving set to True (default) causes the created server
        to start accepting connections immediately.  When set to False,
        the user should await Server.start_serving() or Server.serve_forever()
        to make the server to start accepting connections.
        Nrd)r!r�r�r�r�r�r�rir&r&r'�create_unix_server�sz$AbstractEventLoop.create_unix_server)r�r�r�r�r��allow_broadcastr�c�st�dS)a�A coroutine which creates a datagram endpoint.

        This method will try to establish the endpoint in the background.
        When successful, the coroutine returns a (transport, protocol) pair.

        protocol_factory must be a callable returning a protocol instance.

        socket family AF_INET, socket.AF_INET6 or socket.AF_UNIX depending on
        host (or family if specified), socket type SOCK_DGRAM.

        reuse_address tells the kernel to reuse a local socket in
        TIME_WAIT state, without waiting for its natural timeout to
        expire. If not specified it will automatically be set to True on
        UNIX.

        reuse_port tells the kernel to allow this endpoint to be bound to
        the same port as other existing endpoints are bound to, so long as
        they all set this flag when being created. This option is not
        supported on Windows and some UNIX's. If the
        :py:data:`~socket.SO_REUSEPORT` constant is not defined then this
        capability is unsupported.

        allow_broadcast tells the kernel to allow this endpoint to send
        messages to the broadcast address.

        sock can optionally be specified in order to use a preexisting
        socket object.
        Nrd)r!r�r�Zremote_addrr�r�r�r�r�r�r�r&r&r'�create_datagram_endpoint�s!z*AbstractEventLoop.create_datagram_endpointc�st�dS)aRegister read pipe in event loop. Set the pipe to non-blocking mode.

        protocol_factory should instantiate object with Protocol interface.
        pipe is a file-like object.
        Return pair (transport, protocol), where transport supports the
        ReadTransport interface.Nrd�r!r��piper&r&r'�connect_read_pipe�sz#AbstractEventLoop.connect_read_pipec�st�dS)aRegister write pipe in event loop.

        protocol_factory should instantiate object with BaseProtocol interface.
        Pipe is file-like object already switched to nonblocking.
        Return pair (transport, protocol), where transport support
        WriteTransport interface.Nrdr�r&r&r'�connect_write_pipe�sz$AbstractEventLoop.connect_write_pipe)�stdin�stdout�stderrc�st�dSr;rd)r!r��cmdr�r�r��kwargsr&r&r'�subprocess_shell�sz"AbstractEventLoop.subprocess_shellc�st�dSr;rd)r!r�r�r�r�r#r�r&r&r'�subprocess_exec�sz!AbstractEventLoop.subprocess_execcGst�dSr;rd�r!�fdr"r#r&r&r'�
add_reader�szAbstractEventLoop.add_readercCst�dSr;rd�r!r�r&r&r'�
remove_reader�szAbstractEventLoop.remove_readercGst�dSr;rdr�r&r&r'�
add_writer�szAbstractEventLoop.add_writercCst�dSr;rdr�r&r&r'�
remove_writer�szAbstractEventLoop.remove_writerc�st�dSr;rd)r!r��nbytesr&r&r'�	sock_recvszAbstractEventLoop.sock_recvc�st�dSr;rd)r!r�Zbufr&r&r'�sock_recv_intosz AbstractEventLoop.sock_recv_intoc�st�dSr;rd)r!r��datar&r&r'�sock_sendallszAbstractEventLoop.sock_sendallc�st�dSr;rd)r!r�Zaddressr&r&r'�sock_connectszAbstractEventLoop.sock_connectc�st�dSr;rd)r!r�r&r&r'�sock_acceptszAbstractEventLoop.sock_acceptc�st�dSr;rd)r!r�r�r�r�r�r&r&r'�
sock_sendfileszAbstractEventLoop.sock_sendfilecGst�dSr;rd)r!�sigr"r#r&r&r'�add_signal_handlersz$AbstractEventLoop.add_signal_handlercCst�dSr;rd)r!r�r&r&r'�remove_signal_handlersz'AbstractEventLoop.remove_signal_handlercCst�dSr;rd)r!�factoryr&r&r'�set_task_factorysz"AbstractEventLoop.set_task_factorycCst�dSr;rdr9r&r&r'�get_task_factory"sz"AbstractEventLoop.get_task_factorycCst�dSr;rdr9r&r&r'�get_exception_handler'sz'AbstractEventLoop.get_exception_handlercCst�dSr;rd)r!Zhandlerr&r&r'�set_exception_handler*sz'AbstractEventLoop.set_exception_handlercCst�dSr;rd�r!r%r&r&r'�default_exception_handler-sz+AbstractEventLoop.default_exception_handlercCst�dSr;rdr�r&r&r'rB0sz(AbstractEventLoop.call_exception_handlercCst�dSr;rdr9r&r&r'r5szAbstractEventLoop.get_debugcCst�dSr;rd)r!Zenabledr&r&r'�	set_debug8szAbstractEventLoop.set_debug)r)NN)NN)rN)N)N)NN)rN);r-rGrHrIrnrorprqrrrfrsrbrvrtrwrxryr|r}r�r�r�r�r��socketZ	AF_UNSPECZ
AI_PASSIVEr�r�r�r�r�r�r�r��
subprocess�PIPEr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rBrr�r&r&r&r'r�s��
��
��5�	�����!��%
���rc@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
rz-Abstract policy for accessing the event loop.cCst�dS)a:Get the event loop for the current context.

        Returns an event loop object implementing the BaseEventLoop interface,
        or raises an exception in case no event loop has been set for the
        current context and the current policy does not specify to create one.

        It should never return None.Nrdr9r&r&r'r?sz&AbstractEventLoopPolicy.get_event_loopcCst�dS)z3Set the event loop for the current context to loop.Nrd�r!r$r&r&r'r	Isz&AbstractEventLoopPolicy.set_event_loopcCst�dS)z�Create and return a new event loop object according to this
        policy's rules. If there's need to set this loop as the event loop for
        the current context, set_event_loop must be called explicitly.Nrdr9r&r&r'r
Msz&AbstractEventLoopPolicy.new_event_loopcCst�dS)z$Get the watcher for child processes.Nrdr9r&r&r'rUsz)AbstractEventLoopPolicy.get_child_watchercCst�dS)z$Set the watcher for child processes.Nrd)r!�watcherr&r&r'rYsz)AbstractEventLoopPolicy.set_child_watcherN)	r-rGrHrIrr	r
rrr&r&r&r'r<s
rc@sFeZdZdZdZGdd�dej�Zdd�Zdd�Z	d	d
�Z
dd�ZdS)
�BaseDefaultEventLoopPolicya�Default policy implementation for accessing the event loop.

    In this policy, each thread has its own event loop.  However, we
    only automatically create an event loop by default for the main
    thread; other threads by default have no event loop.

    Other policies may have different rules (e.g. a single global
    event loop, or automatically creating an event loop per thread, or
    using some other notion of context to which an event loop is
    associated).
    Nc@seZdZdZdZdS)z!BaseDefaultEventLoopPolicy._LocalNF)r-rGrHr�_set_calledr&r&r&r'�_Localmsr�cCs|��|_dSr;)r��_localr9r&r&r'r(qsz#BaseDefaultEventLoopPolicy.__init__cCsX|jjdkr2|jjs2tt��tj�r2|�|���|jjdkrPt	dt��j
��|jjS)zvGet the event loop for the current context.

        Returns an instance of EventLoop or raises an exception.
        Nz,There is no current event loop in thread %r.)r�rr�r_�	threadingZcurrent_threadZ_MainThreadr	r
�RuntimeErrorrzr9r&r&r'rts���z)BaseDefaultEventLoopPolicy.get_event_loopcCs*d|j_|dkst|t�st�||j_dS)zSet the event loop.TN)r�r�r_rrMrr�r&r&r'r	�sz)BaseDefaultEventLoopPolicy.set_event_loopcCs|��S)zvCreate a new event loop.

        You must call set_event_loop() to make this the current event
        loop.
        )�
_loop_factoryr9r&r&r'r
�sz)BaseDefaultEventLoopPolicy.new_event_loop)r-rGrHrIr�r��localr�r(rr	r
r&r&r&r'r�^sr�c@seZdZdZdS)�_RunningLoop)NNN)r-rGrH�loop_pidr&r&r&r'r��sr�cCst�}|dkrtd��|S)zrReturn the running event loop.  Raise a RuntimeError if there is none.

    This function is thread-specific.
    Nzno running event loop)rr��r$r&r&r'r�srcCs&tj\}}|dk	r"|t��kr"|SdS)z�Return the running event loop or None.

    This is a low-level function intended to be used by event loops.
    This function is thread-specific.
    N)�
_running_loopr��os�getpid)Zrunning_loop�pidr&r&r'r�s
rcCs|t��ft_dS)z�Set the running event loop.

    This is a low-level function intended to be used by event loops.
    This function is thread-specific.
    N)r�r�r�r�r�r&r&r'r
�sr
c	Cs.t� tdkr ddlm}|�aW5QRXdS)Nr��DefaultEventLoopPolicy)�_lock�_event_loop_policy�r�r�r&r&r'�_init_event_loop_policy�sr�cCstdkrt�tS)z"Get the current event loop policy.N)r�r�r&r&r&r'r�srcCs|dkst|t�st�|adS)zZSet the current event loop policy.

    If policy is None, the default policy is restored.N)r_rrMr�)Zpolicyr&r&r'r�srcCst�}|dk	r|St���S)aGReturn an asyncio event loop.

    When called from a coroutine or a callback (e.g. scheduled with call_soon
    or similar API), this function will always return the running event loop.

    If there is no running event loop set, the function will return
    the result of `get_event_loop_policy().get_event_loop()` call.
    N)rrr)Zcurrent_loopr&r&r'r�s
rcCst��|�dS)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr	r�r&r&r'r	�sr	cCs
t���S)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rr
r&r&r&r'r
�sr
cCs
t���S)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rrr&r&r&r'r�srcCst��|�S)zMEquivalent to calling
    get_event_loop_policy().set_child_watcher(watcher).)rr)r�r&r&r'r�sr)rr
rr),rI�__all__rr�r�r�rr�r�rrrrrrrr�r�ZLockr�r�r�r�rrr
r�rrrr	r
rrZ_py__get_running_loopZ_py__set_running_loopZ_py_get_running_loopZ_py_get_event_loopZ_asyncio�ImportErrorZ_c__get_running_loopZ_c__set_running_loopZ_c_get_running_loopZ_c_get_event_loopr&r&r&r'�<module>sXJ@*q"9