Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/asyncio/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/asyncio/__pycache__/events.cpython-37.pyc

B

� flf�@s�dZdZddlZddlZddlZddlZddlZddlZddlm	Z	Gdd�de
�ZGdd	�d	�ZGd
d�de�Z
Gdd
�d
�ZGdd�d�ZGdd�d�ZGdd�de�Zdae��ZGdd�dej�Ze�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Z d(d)�Z!d*d+�Z"eZ#eZ$eZ%eZ&ydd,l'mZmZmZmZWne(k
�rjYnXeZ)eZ*eZ+eZ,dS)-z!Event loop and event loop policy.)�AbstractEventLoopPolicy�AbstractEventLoop�AbstractServer�Handle�TimerHandle�SendfileNotAvailableError�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_helpersc@seZdZdZdS)rz~Sendfile syscall is not available.

    Raised if OS does not support sendfile syscall for given socket or
    file type.
    N)�__name__�
__module__�__qualname__�__doc__�rr�3/opt/alt/python37/lib64/python3.7/asyncio/events.pyrsrc@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_contextr!rrrrr�	get_debugr�
extract_stack�sys�	_getframer)�self�callback�args�loop�contextrrr�__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__rr�appendrr�_format_callback_sourcerr)r'�info�framerrr�
_repr_info6s



zHandle._repr_infocCs(|jdk	r|jS|��}d�d�|��S)Nz<{}>� )rr5�format�join)r'r3rrr�__repr__Bs
zHandle.__repr__cCs0|js,d|_|j��r t|�|_d|_d|_dS)NT)rrr#�reprrrr)r'rrr�cancelHs

z
Handle.cancelcCs|jS)N)r)r'rrrr-SszHandle.cancelledc
Cs�y|jj|jf|j��Wndtk
r~}zFt�|j|j�}d|��}|||d�}|jrb|j|d<|j�	|�Wdd}~XYnXd}dS)NzException in callback )�messageZ	exception�handleZsource_traceback)
r!�runrr�	Exceptionrr2rr�call_exception_handler)r'�exc�cb�msgr+rrr�_runVs

zHandle._run)N)rrrr�	__slots__r,r5r9r;r-rDrrrrr s
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,rrGrF)r'�whenr(r)r*r+)r0rrr,mszTimerHandle.__init__cs0t���}|jrdnd}|�|d|j���|S)N�rzwhen=)rIr5r�insertrG)r'r3�pos)r0rrr5us
zTimerHandle._repr_infocCs
t|j�S)N)�hashrG)r'rrr�__hash__{szTimerHandle.__hash__cCs|j|jkS)N)rG)r'�otherrrr�__lt__~szTimerHandle.__lt__cCs|j|jkrdS|�|�S)NT)rG�__eq__)r'rPrrr�__le__�szTimerHandle.__le__cCs|j|jkS)N)rG)r'rPrrr�__gt__�szTimerHandle.__gt__cCs|j|jkrdS|�|�S)NT)rGrR)r'rPrrr�__ge__�szTimerHandle.__ge__cCs>t|t�r:|j|jko8|j|jko8|j|jko8|j|jkStS)N)�
isinstancerrGrrr�NotImplemented)r'rPrrrrR�s
zTimerHandle.__eq__cCs|�|�}|tkrtS|S)N)rRrW)r'rPZequalrrr�__ne__�s
zTimerHandle.__ne__cs |js|j�|�t���dS)N)rr�_timer_handle_cancelledrIr;)r')r0rrr;�szTimerHandle.cancelcCs|jS)z�Return a scheduled callback time.

        The time is an absolute timestamp, using the same time
        reference as loop.time().
        )rG)r'rrrrJ�szTimerHandle.when)N)rrrrrEr,r5rOrQrSrTrUrRrXr;rJ�
__classcell__rr)r0rrhs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)�NotImplementedError)r'rrr�close�szAbstractServer.closecCst�dS)z4Get the event loop the Server object is attached to.N)r[)r'rrr�get_loop�szAbstractServer.get_loopcCst�dS)z3Return True if the server is accepting connections.N)r[)r'rrr�
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.
        N)r[)r'rrr�
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.
        N)r[)r'rrr�
serve_forever�szAbstractServer.serve_foreverc�st�dS)z*Coroutine to wait until service is closed.N)r[)r'rrr�wait_closed�szAbstractServer.wait_closedc�s|S)Nr)r'rrr�
__aenter__�szAbstractServer.__aenter__c�s|��|��IdHdS)N)r\ra)r'rArrr�	__aexit__�szAbstractServer.__aexit__N)rrrrr\r]r^r_r`rarbrcrrrrr�src@sLeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d$d$d$d%�d&d'�Zdtd(d)�Zdud*d$d$d$d*d*d*d*d+�d,d-�Zdvejejd*d.d*d*d*d*d/d0�	d1d2�Zdwd/d3�d4d5�Zd6d*d*d7�d8d9�Zdxd*d*d*d*d:�d;d<�Zdyd*d.d*d*d/d=�d>d?�Zdzd$d$d$d*d*d*d*d@�dAdB�Z dCdD�Z!dEdF�Z"e#j$e#j$e#j$dG�dHdI�Z%e#j$e#j$e#j$dG�dJdK�Z&dLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d{d*d3�d^d_�Z0d`da�Z1dbdc�Z2ddde�Z3dfdg�Z4dhdi�Z5djdk�Z6dldm�Z7dndo�Z8dpdq�Z9drds�Z:d*S)|rzAbstract event loop.cCst�dS)z*Run the event loop until stop() is called.N)r[)r'rrr�run_forever�szAbstractEventLoop.run_forevercCst�dS)zpRun the event loop until a Future is done.

        Return the Future's result, or raise its exception.
        N)r[)r'Zfuturerrr�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.
        N)r[)r'rrr�stop�szAbstractEventLoop.stopcCst�dS)z3Return whether the event loop is currently running.N)r[)r'rrr�
is_running�szAbstractEventLoop.is_runningcCst�dS)z*Returns True if the event loop was closed.N)r[)r'rrr�	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.
        N)r[)r'rrrr\�s	zAbstractEventLoop.closec�st�dS)z,Shutdown all active asynchronous generators.N)r[)r'rrr�shutdown_asyncgens�sz$AbstractEventLoop.shutdown_asyncgenscCst�dS)z3Notification that a TimerHandle has been cancelled.N)r[)r'r=rrrrYsz)AbstractEventLoop._timer_handle_cancelledcGs|jd|f|��S)Nr)�
call_later)r'r(r)rrr�	call_soonszAbstractEventLoop.call_sooncGst�dS)N)r[)r'Zdelayr(r)rrrrj
szAbstractEventLoop.call_latercGst�dS)N)r[)r'rJr(r)rrr�call_at
szAbstractEventLoop.call_atcCst�dS)N)r[)r'rrr�timeszAbstractEventLoop.timecCst�dS)N)r[)r'rrr�
create_futureszAbstractEventLoop.create_futurecCst�dS)N)r[)r'�cororrr�create_taskszAbstractEventLoop.create_taskcGst�dS)N)r[)r'r(r)rrr�call_soon_threadsafesz&AbstractEventLoop.call_soon_threadsafec�st�dS)N)r[)r'�executor�funcr)rrr�run_in_executor sz!AbstractEventLoop.run_in_executorcCst�dS)N)r[)r'rrrrr�set_default_executor#sz&AbstractEventLoop.set_default_executorr)�family�type�proto�flagsc�st�dS)N)r[)r'�host�portrvrwrxryrrr�getaddrinfo(szAbstractEventLoop.getaddrinfoc�st�dS)N)r[)r'Zsockaddrryrrr�getnameinfo,szAbstractEventLoop.getnameinfoN)�sslrvrxry�sock�
local_addr�server_hostname�ssl_handshake_timeoutc�st�dS)N)r[)r'�protocol_factoryrzr{r~rvrxryrr�r�r�rrr�create_connection/sz#AbstractEventLoop.create_connection�dT)	rvryr�backlogr~�
reuse_address�
reuse_portr�r_c	
�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.
        N)r[)
r'r�rzr{rvryrr�r~r�r�r�r_rrr�
create_server7s3zAbstractEventLoop.create_server)�fallbackc�st�dS)zRSend a file through a transport.

        Return an amount of sent bytes.
        N)r[)r'�	transport�file�offset�countr�rrr�sendfilelszAbstractEventLoop.sendfileF)�server_sider�r�c�st�dS)z|Upgrade a transport to TLS.

        Return a new transport that *protocol* should start using
        immediately.
        N)r[)r'r�ZprotocolZ
sslcontextr�r�r�rrr�	start_tlsts	zAbstractEventLoop.start_tls)r~rr�r�c�st�dS)N)r[)r'r��pathr~rr�r�rrr�create_unix_connectionsz(AbstractEventLoop.create_unix_connection)rr�r~r�r_c�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.
        N)r[)r'r�r�rr�r~r�r_rrr�create_unix_server�sz$AbstractEventLoop.create_unix_server)rvrxryr�r��allow_broadcastrc�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.
        N)r[)r'r�r�Zremote_addrrvrxryr�r�r�rrrr�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.N)r[)r'r��piperrr�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.N)r[)r'r�r�rrr�connect_write_pipe�sz$AbstractEventLoop.connect_write_pipe)�stdin�stdout�stderrc�st�dS)N)r[)r'r��cmdr�r�r��kwargsrrr�subprocess_shell�sz"AbstractEventLoop.subprocess_shellc�st�dS)N)r[)r'r�r�r�r�r)r�rrr�subprocess_exec�sz!AbstractEventLoop.subprocess_execcGst�dS)N)r[)r'�fdr(r)rrr�
add_reader�szAbstractEventLoop.add_readercCst�dS)N)r[)r'r�rrr�
remove_reader�szAbstractEventLoop.remove_readercGst�dS)N)r[)r'r�r(r)rrr�
add_writer�szAbstractEventLoop.add_writercCst�dS)N)r[)r'r�rrr�
remove_writerszAbstractEventLoop.remove_writerc�st�dS)N)r[)r'r�nbytesrrr�	sock_recvszAbstractEventLoop.sock_recvc�st�dS)N)r[)r'rZbufrrr�sock_recv_into	sz AbstractEventLoop.sock_recv_intoc�st�dS)N)r[)r'r�datarrr�sock_sendallszAbstractEventLoop.sock_sendallc�st�dS)N)r[)r'rZaddressrrr�sock_connectszAbstractEventLoop.sock_connectc�st�dS)N)r[)r'rrrr�sock_acceptszAbstractEventLoop.sock_acceptc�st�dS)N)r[)r'rr�r�r�r�rrr�
sock_sendfileszAbstractEventLoop.sock_sendfilecGst�dS)N)r[)r'�sigr(r)rrr�add_signal_handlersz$AbstractEventLoop.add_signal_handlercCst�dS)N)r[)r'r�rrr�remove_signal_handlersz'AbstractEventLoop.remove_signal_handlercCst�dS)N)r[)r'�factoryrrr�set_task_factory#sz"AbstractEventLoop.set_task_factorycCst�dS)N)r[)r'rrr�get_task_factory&sz"AbstractEventLoop.get_task_factorycCst�dS)N)r[)r'rrr�get_exception_handler+sz'AbstractEventLoop.get_exception_handlercCst�dS)N)r[)r'Zhandlerrrr�set_exception_handler.sz'AbstractEventLoop.set_exception_handlercCst�dS)N)r[)r'r+rrr�default_exception_handler1sz+AbstractEventLoop.default_exception_handlercCst�dS)N)r[)r'r+rrrr@4sz(AbstractEventLoop.call_exception_handlercCst�dS)N)r[)r'rrrr#9szAbstractEventLoop.get_debugcCst�dS)N)r[)r'Zenabledrrr�	set_debug<szAbstractEventLoop.set_debug)r)NN)NN)rN)N)N)NN)rN);rrrrrdrerfrgrhr\rirYrkrjrlrmrnrprqrtrur|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�r@r#r�rrrrr�s�
/	!
	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.N)r[)r'rrrr	Csz&AbstractEventLoopPolicy.get_event_loopcCst�dS)z3Set the event loop for the current context to loop.N)r[)r'r*rrrr
Msz&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.N)r[)r'rrrrQsz&AbstractEventLoopPolicy.new_event_loopcCst�dS)z$Get the watcher for child processes.N)r[)r'rrrrYsz)AbstractEventLoopPolicy.get_child_watchercCst�dS)z$Set the watcher for child processes.N)r[)r'�watcherrrrr
]sz)AbstractEventLoopPolicy.set_child_watcherN)	rrrrr	r
rrr
rrrrr@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)rrrr�_set_calledrrrr�_Localqsr�cCs|��|_dS)N)r��_local)r'rrrr,usz#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�rV�	threadingZcurrent_threadZ_MainThreadr
r�RuntimeError�name)r'rrrr	xsz)BaseDefaultEventLoopPolicy.get_event_loopcCs*d|j_|dkst|t�st�||j_dS)zSet the event loop.TN)r�r�rVrrHr)r'r*rrrr
�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_factory)r'rrrr�sz)BaseDefaultEventLoopPolicy.new_event_loop)rrrrr�r��localr�r,r	r
rrrrrr�bsr�c@seZdZdZdS)�_RunningLoop)NNN)rrr�loop_pidrrrrr��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*rrrr�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�pidrrrr�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*rrrr�src	Cs.t� tdkr ddlm}|�aWdQRXdS)Nr)�DefaultEventLoopPolicy)�_lock�_event_loop_policy�r�)r�rrr�_init_event_loop_policy�sr�cCstdkrt�tS)z"Get the current event loop policy.N)r�r�rrrrr�srcCs|dkst|t�st�|adS)zZSet the current event loop policy.

    If policy is None, the default policy is restored.N)rVrrHr�)Zpolicyrrrr�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_looprrrr	�s
r	cCst��|�dS)zCEquivalent to calling get_event_loop_policy().set_event_loop(loop).N)rr
)r*rrrr
�sr
cCs
t���S)z?Equivalent to calling get_event_loop_policy().new_event_loop().)rrrrrrr�srcCs
t���S)zBEquivalent to calling get_event_loop_policy().get_child_watcher().)rrrrrrr�srcCst��|�S)zMEquivalent to calling
    get_event_loop_policy().set_child_watcher(watcher).)rr
)r�rrrr
sr
)rrrr	)-r�__all__r"r�r�r�r%r�r�rr�rrrrrrr�r�ZLockr�r�r�r�rrrr�rrr	r
rrr
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_looprrrr�<module>sX
H@*p"9
	

Hacked By AnonymousFox1.0, Coded By AnonymousFox