
    Ef                        U d Z ddlZddlZddlmZ 	 ddlZddlmZ ddlmZ  e	ej                  d      s ed eedd	      z        	 ej                  Z G d de      Zd Zde_        eed<   dej(                  v rd
dlmZ nDej                  Z ej.                         eur% ej.                         Z ej.                         eur% G d de      ZeZ
d Zdej(                  v rd
dlm
Z
mZmZ yy# e$ r d
dlmZ d
dlmZ Y w xY w)ztornado IOLoop API with zmq compatibility

This module is deprecated in pyzmq 17.
To use zmq with tornado,
eventloop integration is no longer required
and tornado itself should be used.
    N)Any)ioloop)gen_logconfigurable_defaultzTornado too old: %sversionunknown   c                   0     e Zd ZdZd fd	Zd Zd Z xZS )DelayedCallbackzSchedules 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.
    c                 t    t        j                  dt               t        |d      }t        |   |||       y )NzDDelayedCallback is deprecated.
        Use loop.add_timeout instead.gMbP?)warningswarnDeprecationWarningmaxsuper__init__)selfcallbackcallback_timeio_loop	__class__s       6/usr/lib/python3/dist-packages/zmq/eventloop/ioloop.pyr   zDelayedCallback.__init__+   s6    )	

 M40=':    c                     d| _         d| _        t        j                         | j                  dz  z   | _        | j
                  j                  | j                  | j                         y)zStarts the timer.Tg     @@N)_running	_firstruntimer   _next_timeoutr   add_timeout_runr   s    r   startzDelayedCallback.start5   sL    !YY[4+=+=+FF  !3!3TYY?r   c                     | j                   sy d| _         	 | j                          y # t        $ r t        j                  dd       Y y w xY w)NFzError in delayed callbackT)exc_info)r   r   	Exceptionr   errorr!   s    r   r    zDelayedCallback._run<   sB    }}	FMMO 	FMM5E	Fs   '  A
	A
N)__name__
__module____qualname____doc__r   r"   r    __classcell__r   s   @r   r   r   !   s    ;@Fr   r   c                  t    t         j                  ry dt         _        t        j                  dt        d       y )NTzlzmq.eventloop.ioloop is deprecated in pyzmq 17. pyzmq now works with default tornado and asyncio eventloops.   )
stacklevel)_deprecatedcalledr   r   r    r   r   r1   r1   F   s.    KMM	H	r   F_IOLoopz.minitornado.)	ZMQIOLoopc                   B     e Zd ZdZ fdZed        Zed        Z xZS )r5   zDEPRECATED: No longer needed as of pyzmq-17

    PyZMQ tornado integration now works with the default :mod:`tornado.ioloop.IOLoop`.
    c                 4    t                t        | 	         S r'   )r1   r   r   )r   argskwargsr   s      r   r   zZMQIOLoop.__init__d   s    w!!r   c                     t         j                  j                  |        t                t        j                  j                  |i |}|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()`.
        )r   IOLoop	configurer1   instanceclsr8   r9   loops       r   r=   zZMQIOLoop.instancei   s9     	$}}%%t6v6r   c                     t         j                  j                  |        t                t        j                  j                  |i |}|S )u&   Returns the current thread’s IOLoop.)r   r;   r<   r1   currentr>   s       r   rB   zZMQIOLoop.currentx   s9    
 	$}}$$d5f5r   )	r(   r)   r*   r+   r   classmethodr=   rB   r,   r-   s   @r   r5   r5   ^   s5    
"
    r   r5   c                  ^    t                t        j                  j                  t               y)zRDEPRECATED

    pyzmq 17 no longer needs any special integration for tornado.
    N)r1   r   r;   r<   r5   r3   r   r   installrE      s    
 M
MMI&r   )r;   r5   rE   )r+   r   r   typingr   tornador   tornado.logr   hasattrr;   ImportErrorgetattrminitornadominitornado.logPeriodicCallbackr   r1   r2   __annotations__r(   r5   r4   r   rE   r3   r   r   <module>rP      s!     )#6=="89!GGY	$JJ
 	
 : ** "F& "FJ	  	foo%1mmG
&'
&
&
(
7.'..0 ''
&
&
(
7" "L 
' foo%77 &o  )#()s   6C3 3DD