o
    0׾g&                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ e	dZ
zdd	lmZ W n eyI   G d
d deZG dd deZY nw g dZG dd deZG dd deZG dd deZdS )z
Interfaces gevent uses that don't belong any one place.

This is not a public module, these interfaces are not
currently exposed to the public, they mostly exist for
documentation and testing purposes.

.. versionadded:: 1.3b2

    )absolute_import)division)print_functionN)	Interface)	Attribute )schemac                   @   s   e Zd ZdZdddZdS )_Field)readonlyminFc                 K   sT   d||f }t |tsJ | jD ]}||d  q|r"td|f t| | d S )Nz%s (required? %s)z Unexpected keyword arguments: %r)
isinstance
_text_type__allowed_kw__pop	TypeErrorr   __init__)selfdescriptionrequiredkwargsk r   \/var/www/html/backend_erp/backend_erp_env/lib/python3.10/site-packages/gevent/_interfaces.pyr      s   
z_Field.__init__N)F)__name__
__module____qualname__r   r   r   r   r   r   r	      s    r	   c                   @   s   e Zd ZeZeZdS )r   N)r   r   r   r	   BoolFloatr   r   r   r   r   &   s    r   )ILoopIWatcher	ICallbackc                   @   s   e Zd ZdZejddddZejdddddZd.d	d
Z	dd Z
dd Zdd Zd/ddZdd Zd0ddZd/ddZd/ddZd/ddZd/ddZd/d d!Zd/d"d#Zejd$kr^d1d&d'Zd0d(d)Zd*d+ Zd,d- ZdS )2r   al  
    The common interface expected for all event loops.

    .. caution::
       This is an internal, low-level interface. It may change
       between minor versions of gevent.

    .. rubric:: Watchers

    The methods that create event loop watchers are `io`, `timer`,
    `signal`, `idle`, `prepare`, `check`, `fork`, `async_`, `child`,
    `stat`. These all return various types of :class:`IWatcher`.

    All of those methods have one or two common arguments. *ref* is a
    boolean saying whether the event loop is allowed to exit even if
    this watcher is still started. *priority* is event loop specific.
    z3Boolean indicating whether this is the default loopT)r   r   r
   a  Floating point number of seconds giving (approximately) the minimum resolution of a timer (and hence the minimun value the sleep can sleep for). On libuv, this is fixed by the library, but on libev it is just a guess and the actual value is system dependent.        )r   r   r   r
   Fc                 C      dS )a!  
        Run the event loop.

        This is usually called automatically by the hub greenlet, but
        in special cases (when the hub is *not* running) you can use
        this to control how the event loop runs (for example, to integrate
        it with another event loop).
        Nr   )nowaitoncer   r   r   runW       z	ILoop.runc                   C   r"   )a0  
        now() -> float

        Return the loop's notion of the current time.

        This may not necessarily be related to :func:`time.time` (it
        may have a different starting point), but it must be expressed
        in fractional seconds (the same *units* used by :func:`time.time`).
        Nr   r   r   r   r   nowa   r&   z	ILoop.nowc                   C   r"   )z
        Update the loop's notion of the current time.

        .. versionadded:: 1.3
           In the past, this available as ``update``. This is still available as
           an alias but will be removed in the future.
        Nr   r   r   r   r   
update_nowl   r&   zILoop.update_nowc                   C   r"   )a  
        Clean up resources used by this loop.

        If you create loops
        (especially loops that are not the default) you *should* call
        this method when you are done with the loop.

        .. caution::

            As an implementation note, the libev C loop implementation has a
            finalizer (``__del__``) that destroys the object, but the libuv
            and libev CFFI implementations do not. The C implementation may change.

        Nr   r   r   r   r   destroyu   r&   zILoop.destroyNc                 C   r"   )z
        Create and return a new IO watcher for the given *fd*.

        *events* is a bitmask specifying which events to watch
        for. 1 means read, and 2 means write.
        Nr   )fdeventsrefpriorityr   r   r   io   r&   zILoop.ioc                 C   r"   )a  
        Inform the loop that the file descriptor *fd* is about to be closed.

        The loop may choose to schedule events to be delivered to any active
        IO watchers for the fd. libev does this so that the active watchers
        can be closed.

        :return: A boolean value that's true if active IO watchers were
           queued to run. Closing the FD should be deferred until the next
           run of the eventloop with a callback.
        Nr   )r*   r   r   r   
closing_fd   r&   zILoop.closing_fdc                 C   r"   )z
        Create and return a timer watcher that will fire after *after* seconds.

        If *repeat* is given, the timer will continue to fire every *repeat* seconds.
        Nr   )afterrepeatr,   r-   r   r   r   timer   r&   zILoop.timerc                 C   r"   )z
        Create and return a signal watcher for the signal *signum*,
        one of the constants defined in :mod:`signal`.

        This is platform and event loop specific.
        Nr   )signumr,   r-   r   r   r   signal   r&   zILoop.signalc                 C   r"   )zU
        Create and return a watcher that fires when the event loop is idle.
        Nr   r,   r-   r   r   r   idle   r&   z
ILoop.idlec                 C   r"   )z
        Create and return a watcher that fires before the event loop
        polls for IO.

        .. caution:: This method is not supported by libuv.
        Nr   r5   r   r   r   prepare   r&   zILoop.preparec                 C   r"   )zc
        Create and return a watcher that fires after the event loop
        polls for IO.
        Nr   r5   r   r   r   check   r&   zILoop.checkc                 C   r"   )zb
        Create a watcher that fires when the process forks.

        Availability: Unix.
        Nr   r5   r   r   r   fork   r&   z
ILoop.forkc                 C   r"   )a  
        Create a watcher that fires when triggered, possibly
        from another thread.

        .. versionchanged:: 1.3
           This was previously just named ``async``; for compatibility
           with Python 3.7 where ``async`` is a keyword it was renamed.
           On older versions of Python the old name is still around, but
           it will be removed in the future.
        Nr   r5   r   r   r   async_   r&   zILoop.async_win32r   c                 C   r"   )z
            Create a watcher that fires for events on the child with process ID *pid*.

            This is platform specific and not available on Windows.

            Availability: Unix.
            Nr   )pidtracer,   r   r   r   child   r&   zILoop.childc                 C   r"   )z
        Create a watcher that monitors the filesystem item at *path*.

        If the operating system doesn't support event notifications
        from the filesystem, poll for changes every *interval* seconds.
        Nr   )pathintervalr,   r-   r   r   r   stat   r&   z
ILoop.statc                 G   r"   )a  
        Run the *func* passing it *args* at the next opportune moment.

        The next opportune moment may be the next iteration of the event loop,
        the current iteration, or some other time in the future.

        Returns a :class:`ICallback` object. See that documentation for
        important caveats.

        .. seealso:: :meth:`asyncio.loop.call_soon`
           The :mod:`asyncio` equivalent.
        Nr   funcargsr   r   r   run_callback   r&   zILoop.run_callbackc                 G   r"   )a  
        Like :meth:`run_callback`, but for use from *outside* the
        thread that is running this loop.

        This not only schedules the *func* to run, it also causes the
        loop to notice that the *func* has been scheduled (e.g., it causes
        the loop to wake up).

        .. versionadded:: 21.1.0

        .. seealso:: :meth:`asyncio.loop.call_soon_threadsafe`
           The :mod:`asyncio` equivalent.
        Nr   rB   r   r   r   run_callback_threadsafe   r&   zILoop.run_callback_threadsafe)FF)TN)r!   TN)r   T)r   r   r   __doc__r   r   defaultr   approx_timer_resolutionr%   r'   r(   r)   r.   r/   r2   r4   r6   r7   r8   r9   r:   sysplatformr>   rA   rE   rF   r   r   r   r   r   4   s>    


	










	r   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	r   a	  
    An event loop watcher.

    These objects call their *callback* function when the event
    loop detects the event has happened.

    .. important:: You *must* call :meth:`close` when you are
       done with this object to avoid leaking native resources.
    c                 O   r"   )a1  
        Have the event loop begin watching for this event.

        When the event is detected, *callback* will be called with
        *args*.

        .. caution::

            Not all watchers accept ``**kwargs``,
            and some watchers define special meanings for certain keyword args.
        Nr   )callbackrD   r   r   r   r   start
  r&   zIWatcher.startc                   C   r"   )z
        Have the event loop stop watching this event.

        In the future you may call :meth:`start` to begin watching
        again.
        Nr   r   r   r   r   stop  r&   zIWatcher.stopc                   C   r"   )a  
        Dispose of any native resources associated with the watcher.

        If we were active, stop.

        Attempting to operate on this object after calling close is
        undefined. You should dispose of any references you have to it
        after calling this method.
        Nr   r   r   r   r   close  r&   zIWatcher.closeN)r   r   r   rG   rM   rN   rO   r   r   r   r   r      s
    
r   c                   @   s.   e Zd ZdZejdddZdd Zdd Zd	S )
r    z
    Represents a function that will be run some time in the future.

    Callback functions run in the hub, and as such they cannot use
    gevent's blocking API; any exception they raise cannot be caught.
    zHas this callback run yet?T)r   r
   c                   C   r"   )z~
        If this object is still `pending`, cause it to
        no longer be `pending`; the function will not be run.
        Nr   r   r   r   r   rN   5  r&   zICallback.stopc                   C   r"   )z%
        An alias of `stop`.
        Nr   r   r   r   r   rO   ;  r&   zICallback.closeN)	r   r   r   rG   r   r   pendingrN   rO   r   r   r   r   r    *  s    r    )rG   
__future__r   r   r   rJ   zope.interfacer   r   typer   zoper   ImportErrorr	   object__all__r   r   r    r   r   r   r   <module>   s&   
 L+