ó
[łXMc           @   sE   d  Z  d d l Z e j d d e d d d e f d     YZ d S(	   s   
Helper class to writing deterministic time-based unit tests.

Do not use this module.  It is a lie.  See L{twisted.internet.task.Clock}
instead.
i˙˙˙˙Nse   twisted.test.time_helpers is deprecated since Twisted 10.0.  See twisted.internet.task.Clock instead.t   categoryt
   stackleveli   t   Clockc           B   sA   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z RS(   s§   
    A utility for monkey-patches various parts of Twisted to use a
    simulated timing mechanism. DO NOT use this class. Use
    L{twisted.internet.task.Clock}.
    g        c         C   s   |  j  S(   s4   
        Return the current simulated time.
        (   t   rightNow(   t   self(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt   __call__   s    c         C   s)   d d l  m } | j |  _ |  | _ d S(   sm   
        Monkeypatch L{twisted.internet.reactor.seconds} to use
        L{__call__} as a time source
        i˙˙˙˙(   t   reactorN(   t   twisted.internetR   t   secondst   reactor_original(   R   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt   install    s    c         C   s    d d l  m } |  j | _ d S(   sS   
        Remove the monkeypatching of L{twisted.internet.reactor.seconds}.
        i˙˙˙˙(   R   N(   R   R   R	   R   (   R   R   (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt	   uninstall*   s    c         C   s   |  j  | 7_  d S(   s   
        Adjust the current simulated time upward by the given C{amount}.

        Note that this does not cause any scheduled calls to be run.
        N(   R   (   R   t   amount(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt   adjust1   s    c         C   sa   t  |  } | j   |  j | j    x1 | r\ |  j | j    | j   | j   q, Wd S(   sŘ   
        Iterate the given C{reactor} with increments of time specified
        by C{timings}.

        For each timing, the simulated time will be L{adjust}ed and
        the reactor will be iterated twice.
        N(   t   listt   reverseR   t   popt   iterate(   R   R   t   timings(    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt   pump9   s    
	
(	   t   __name__t
   __module__t   __doc__R   R   R
   R   R   R   (    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyR      s   		
		(   R   t   warningst   warnt   DeprecationWarningt   objectR   (    (    (    s=   /usr/lib/python2.7/dist-packages/twisted/test/time_helpers.pyt   <module>	   s
   