§
    ‹Ÿj+  ã                   ó  — U d Z ddlZddlZddlmZ ddlmZmZmZm	Z	m
Z
mZ dZeed<   	 ddlZej        Zn# eef$ r Y nw xY wddlmZmZ dd	lmZ  G d
„ de¦  «        Z G d„ d¦  «        Z G d„ de¦  «        ZeZd„ ZdS )uX  tornado IOLoop API with zmq compatibility

If you have tornado â‰¥ 3.0, this is a subclass of tornado's IOLoop,
otherwise we ship a minimal subset of tornado in zmq.eventloop.minitornado.

The minimal shipped version of tornado's IOLoop does not include
support for concurrent futures - this will only be available if you
have tornado â‰¥ 3.0.
é    N)ÚTuple)ÚETERMÚPOLLERRÚPOLLINÚPOLLOUTÚPollerÚZMQError© Útornado_versioné   )ÚPeriodicCallbackÚ
PollIOLoop)Úgen_logc                   ó0   ‡ — e Zd ZdZdˆ fd„	Zd„ Zd„ Zˆ xZS )ÚDelayedCallbackzöSchedules the given callback to be called once.

    The callback is called once, after callback_time milliseconds.

    `start` must be called after the DelayedCallback is created.

    The timeout is calculated from when `start` is called.
    Nc                 ó¢   •— t          j        dt          ¦  «         t          |d¦  «        }t	          ¦   «                              |||¦  «         d S )NzDDelayedCallback is deprecated.
        Use loop.add_timeout instead.gü©ñÒMbP?)ÚwarningsÚwarnÚDeprecationWarningÚmaxÚsuperÚ__init__)ÚselfÚcallbackÚcallback_timeÚio_loopÚ	__class__s       €úf/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/zmq/eventloop/_deprecated.pyr   zDelayedCallback.__init__*   sR   ø€ åŒð)åñ	
ô 	
ð 	
õ
 ˜M¨4Ñ0Ô0ˆÝ‰Œ×Ò˜ =°'Ñ:Ô:Ð:Ð:Ð:ó    c                 ó²   — d| _         d| _        t          j        ¦   «         | j        dz  z   | _        | j                             | j        | j        ¦  «         dS )zStarts the timer.Tg     @�@N)Ú_runningÚ	_firstrunÚtimer   Ú_next_timeoutr   Úadd_timeoutÚ_run©r   s    r   ÚstartzDelayedCallback.start4   sN   € àˆŒØˆŒÝ!œY™[œ[¨4Ô+=ÀÑ+FÑFˆÔØŒ× Ò  Ô!3°T´YÑ?Ô?Ð?Ð?Ð?r   c                 óž   — | j         sd S d| _         	 |                      ¦   «          d S # t          $ r t          j        dd¬¦  «         Y d S w xY w)NFzError in delayed callbackT)Úexc_info)r!   r   Ú	Exceptionr   Úerrorr'   s    r   r&   zDelayedCallback._run;   sm   € ØŒ}ð 	ØˆFØˆŒð	FØ�MŠM‰OŒOˆOˆOˆOøÝð 	Fð 	Fð 	FÝŒMÐ5ÀÐEÑEÔEÐEÐEÐEÐEð	Føøøs   ’( ¨ AÁA©N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r(   r&   Ú__classcell__©r   s   @r   r   r       so   ø€ € € € € ðð ð;ð ;ð ;ð ;ð ;ð ;ð@ð @ð @ðFð Fð Fð Fð Fð Fð Fr   r   c                   ób   — e Zd ZdZd„ Zed„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Z	d„ Z
d„ Zd	„ Zd
S )Ú	ZMQPollerz¶A poller that can be used in the tornado IOLoop.

    This simply wraps a regular zmq.Poller, scaling the timeout
    by 1000, so that it is in seconds rather than milliseconds.
    c                 ó,   — t          ¦   «         | _        d S r-   )r   Ú_pollerr'   s    r   r   zZMQPoller.__init__L   s   € Ý‘x”xˆŒˆˆr   c                 ó    — d}| t           j        z  r
|t          z  }| t           j        z  r
|t          z  }| t           j        z  r
|t          z  }|S )zEtranslate IOLoop.READ/WRITE/ERROR event masks into zmq.POLLIN/OUT/ERRr   )ÚIOLoopÚREADr   ÚWRITEr   ÚERRORr   )ÚeventsÚz_eventss     r   Ú_map_eventszZMQPoller._map_eventsO   sY   € ð ˆØ•F”KÑð 	Ø�ÑˆHØ•F”LÑ ð 	 Ø�ÑˆHØ•F”LÑ ð 	 Ø�ÑˆHØˆr   c                 ó    — d}| t           z  r|t          j        z  }| t          z  r|t          j        z  }| t
          z  r|t          j        z  }|S )zEtranslate zmq.POLLIN/OUT/ERR event masks into IOLoop.READ/WRITE/ERRORr   )r   r9   r:   r   r;   r   r<   )r>   r=   s     r   Ú_remap_eventszZMQPoller._remap_events[   sY   € ð ˆØ•fÑð 	"Ø•f”kÑ!ˆFØ•gÑð 	#Ø•f”lÑ"ˆFØ•gÑð 	#Ø•f”lÑ"ˆFØˆr   c                 ó^   — | j                              ||                      |¦  «        ¦  «        S r-   )r7   Úregisterr?   ©r   Úfdr=   s      r   rC   zZMQPoller.registerg   s(   € ØŒ|×$Ò$ R¨×)9Ò)9¸&Ñ)AÔ)AÑBÔBÐBr   c                 ó^   — | j                              ||                      |¦  «        ¦  «        S r-   )r7   Úmodifyr?   rD   s      r   rG   zZMQPoller.modifyj   s(   € ØŒ|×"Ò" 2 t×'7Ò'7¸Ñ'?Ô'?Ñ@Ô@Ð@r   c                 ó6   — | j                              |¦  «        S r-   )r7   Ú
unregister)r   rE   s     r   rI   zZMQPoller.unregisterm   s   € ØŒ|×&Ò& rÑ*Ô*Ð*r   c                 óZ   ‡ — ‰ j                              d|z  ¦  «        }ˆ fd„|D ¦   «         S )zgpoll in seconds rather than milliseconds.

        Event masks will be IOLoop.READ/WRITE/ERROR
        iè  c                 óD   •— g | ]\  }}|‰                      |¦  «        f‘ŒS r
   )rA   )Ú.0rE   Úevtr   s      €r   ú
<listcomp>z"ZMQPoller.poll.<locals>.<listcomp>v   s0   ø€ ÐHÐHÐH±)°2°s��T×'Ò'¨Ñ,Ô,Ð-ÐHÐHÐHr   )r7   Úpoll)r   Útimeoutr>   s   `  r   rO   zZMQPoller.pollp   s8   ø€ ð
 ”<×$Ò$ T¨G¡^Ñ4Ô4ˆØHÐHÐHÐH¸xÐHÑHÔHÐHr   c                 ó   — d S r-   r
   r'   s    r   ÚclosezZMQPoller.closex   s   € Øˆr   N)r.   r/   r0   r1   r   Ústaticmethodr?   rA   rC   rG   rI   rO   rR   r
   r   r   r5   r5   E   s·   € € € € € ðð ð ð  ð  ð ð	ð 	ñ „\ð	ð ð	ð 	ñ „\ð	ðCð Cð CðAð Að Að+ð +ð +ðIð Ið Iðð ð ð ð r   r5   c                   ó^   ‡ — e Zd ZdZeZdˆ fd„	Zed„ ¦   «         Zed„ ¦   «         Z	ˆ fd„Z
ˆ xZS )Ú	ZMQIOLoopzfZMQ subclass of tornado's IOLoop

    Minor modifications, so that .current/.instance return self
    Nc                 ón   •— |€|                       ¦   «         n|} t          ¦   «         j        dd|i|¤Ž d S )NÚimplr
   )Ú	_zmq_implr   Ú
initialize)r   rW   Úkwargsr   s      €r   rY   zZMQIOLoop.initialize„   sC   ø€ Ø#' <ˆt�~Š~ÑÔÐ°TˆØ�‰ŒÔÐ/Ð/ Ð/¨Ð/Ð/Ð/Ð/Ð/r   c                 óÊ   — t           dk    rt          j        | ¦  «         t          j        |i |¤Ž}t	          || ¦  «        s"t          j        d| ›d|›�t          d¬¦  «         |S )a  Returns a global `IOLoop` instance.

        Most applications have a single, global `IOLoop` running on the
        main thread.  Use this method to get this instance from
        another thread.  To get the current thread's `IOLoop`, use `current()`.
        ©é   ú$IOLoop.current expected instance of ú, got é   ©Ú
stacklevel)r   r   Ú	configureÚinstanceÚ
isinstancer   r   ÚRuntimeWarning©ÚclsÚargsrZ   Úloops       r   rd   zZMQIOLoop.instanceˆ   s€   € õ ˜dÒ"Ð"ÝÔ  Ñ%Ô%Ð%ÝÔ" DÐ3¨FÐ3Ð3ˆÝ˜$ Ñ$Ô$ð 	ÝŒMØL°sÐLÐLÀDÐLÐLÝØðñ ô ð ð
 ˆr   c                 óÊ   — t           dk    rt          j        | ¦  «         t          j        |i |¤Ž}t	          || ¦  «        s"t          j        d| ›d|›�t          d¬¦  «         |S )u&   Returns the current threadâ€™s IOLoop.r\   r^   r_   r`   ra   )r   r   rc   Úcurrentre   r   r   rf   rg   s       r   rl   zZMQIOLoop.current�   s€   € õ
 ˜dÒ"Ð"ÝÔ  Ñ%Ô%Ð%ÝÔ! 4Ð2¨6Ð2Ð2ˆÝ˜$ Ñ$Ô$ð 	ÝŒMØL°sÐLÐLÀDÐLÐLÝØðñ ô ð ð
 ˆr   c                 óž   •— 	 t          ¦   «                              ¦   «          d S # t          $ r}|j        t          k    rn‚ Y d }~d S d }~ww xY wr-   )r   r(   r	   Úerrnor   )r   Úer   s     €r   r(   zZMQIOLoop.start­   s^   ø€ ð	Ý‰GŒG�MŠM‰OŒOˆOˆOˆOøÝð 	ð 	ð 	ØŒw�%ÒÐààð �����øøøøð	øøøs   ƒ % ¥
A¯AÁAr-   )r.   r/   r0   r1   r5   rX   rY   Úclassmethodrd   rl   r(   r2   r3   s   @r   rU   rU   |   s�   ø€ € € € € ðð ð
 €Ið0ð 0ð 0ð 0ð 0ð 0ð ðð ñ „[ðð( ðð ñ „[ððð ð ð ð ð ð ð ð r   rU   c                  óZ  — ddl m}  | j                             ¦   «         r<| j                             ¦   «         t                               ¦   «         u s
J d¦   «         ‚t
          dk    r!| j                             t          ¦  «         dS t                               ¦   «         | j        _        dS )a,  set the tornado IOLoop instance with the pyzmq IOLoop.

    After calling this function, tornado's IOLoop.instance() and pyzmq's
    IOLoop.instance() will return the same object.

    An assertion error will be raised if tornado's IOLoop has been initialized
    prior to calling this function.
    r   ©Úioloopz"tornado IOLoop already initializedr\   N)	Útornadors   r9   Úinitializedrd   r   rc   rU   Ú	_instancerr   s    r   Úinstallrw   ¼   s§   € ð ÐÐÐÐÐð
 ŒM×%Ò%Ñ'Ô'ðà	Œ×	Ò	Ñ	!Ô	!¥V§_¢_Ñ%6Ô%6Ð	6Ð	6Ð	6Ø,ñ 
7Ô	6Ð	6õ ˜$ÒÐàŒ×Ò¥	Ñ*Ô*Ð*Ð*Ð*õ #)§/¢/Ñ"3Ô"3ˆŒÔÐÐr   )r1   r#   r   Útypingr   Úzmqr   r   r   r   r   r	   r   Ú__annotations__rt   Úversion_infoÚImportErrorÚAttributeErrorÚminitornado.ioloopr   r   Úminitornado.logr   r   r5   rU   r9   rw   r
   r   r   ú<module>r€      s‹  ððð ð ð €€€Ø €€€Ø Ð Ð Ð Ð Ð à AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ AÐ Aà€�Ð Ð Ñ ð	Ø€N€N€NàÔ*€O€OøØ�^Ð$ð 	ð 	ð 	Ø€Dð	øøøð =Ð <Ð <Ð <Ð <Ð <Ð <Ð <Ø $Ð $Ð $Ð $Ð $Ð $ð"Fð "Fð "Fð "Fð "FÐ&ñ "Fô "Fð "FðJ4ð 4ð 4ð 4ð 4ñ 4ô 4ð 4ðn9ð 9ð 9ð 9ð 9�
ñ 9ô 9ð 9ðz 
€ð4ð 4ð 4ð 4ð 4s   ª6 ¶A ¿A 