o
    i                     @   s^   d Z ddlZddlZddlmZmZ ddlZddlmZ ddl	m
Z
 G dd de
ZdgZdS )	zOZAP Authenticator integrated with the asyncio IO loop.

.. versionadded:: 15.2
    N)AnyOptional)Poller   )Authenticatorc                	       s|   e Zd ZU dZee ed< eed< 				dded ded	ed
ef fddZ	dddZ
d fddZd fddZ  ZS )AsyncioAuthenticatorz1ZAP authentication for use in the asyncio IO loop_AsyncioAuthenticator__poller_AsyncioAuthenticator__taskNutf-8contextzzmq.Contextloopencodinglogc                    sB   t  ||| |d urtj| jj dtdd d | _d | _d S )Nz (loop) is deprecated and ignored   )
stacklevel)	super__init__warningswarn	__class____name__DeprecationWarningr   r	   )selfr   r   r   r   r    K/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/zmq/auth/asyncio.pyr      s   
zAsyncioAuthenticator.__init__returnc                    sV   | j d ur)| j  I d H }| jt|v r"| j }| |I d H  | j d usd S d S )N)r   poll
zap_socketdictrecv_multiparthandle_zap_message)r   eventsmsgr   r   r   __handle_zap*   s   

z!AsyncioAuthenticator.__handle_zapc                    s8   t    t | _| j| jtj t	| 
 | _dS )zStart ZAP authenticationN)r   startr   r   registerr   zmqPOLLINasyncioensure_future!_AsyncioAuthenticator__handle_zapr	   r   r   r   r   r%   1   s   
zAsyncioAuthenticator.startc                    s8   | j r| j   | jr| j| j d| _t   dS )zStop ZAP authenticationN)r	   cancelr   
unregisterr   r   stopr,   r   r   r   r/   8   s   
zAsyncioAuthenticator.stop)NNr
   N)r   N)r   
__module____qualname____doc__r   r   __annotations__r   strr   r+   r%   r/   __classcell__r   r   r   r   r      s(   
 
r   )r2   r)   r   typingr   r   r'   zmq.asyncior   baser   r   __all__r   r   r   r   <module>   s    
/