§
    Hºi:4  ã                   ó<  — d dl mZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ d d	lmZ d dlZg d
¢Zej        Zdd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZeZd„ Zd„ dde	j        fdde	j        ffD ¦   «         \  ZZd„ Z G d„ dej        ¦  «        Zd„ Zd„ Z dS )é    )ÚdequeN)ÚGreenletExit)Úevent)Úhubs)Úsupport)Útimeout)Útimer)Ú	greenlets)Ú
getcurrentÚsleepÚspawnÚspawn_nÚkillÚspawn_afterÚspawn_after_localÚGreenThreadc                 ó.  — t          j        ¦   «         }t          ¦   «         }|j        |u r| dk    rdS t	          d¦  «        ‚|                     | |j        ¦  «        }	 |                     ¦   «           |j        ¦   «          dS #  |j        ¦   «          w xY w)a	  Yield control to another eligible coroutine until at least *seconds* have
    elapsed.

    *seconds* may be specified as an integer, or a float if fractional seconds
    are desired. Calling :func:`~greenthread.sleep` with *seconds* of 0 is the
    canonical way of expressing a cooperative yield. For example, if one is
    looping over a large list performing an expensive calculation without
    calling any socket methods, it's a good idea to call ``sleep(0)``
    occasionally; otherwise nothing else will run.
    r   Nz0do not call blocking functions from the mainloop)r   Úget_hubr   ÚgreenletÚRuntimeErrorÚschedule_call_globalÚswitchÚcancel)ÚsecondsÚhubÚcurrentr	   s       úY/home/mmwave/public_html/mmwave/venv/lib/python3.11/site-packages/eventlet/greenthread.pyr   r      s�   € õ Œ,‰.Œ.€CÝ‰lŒl€GØ
„|�wÐÐØ�aŠ<ˆ<ð ˆFÝÐMÑNÔNÐNØ×$Ò$ W¨g¬nÑ=Ô=€EðØ�
Š
‰ŒˆàˆŒ‰ŒˆˆˆøˆˆŒ‰Œˆˆøøøs   ÁB ÂBc                 ó�   — t          j        ¦   «         }t          |j        ¦  «        }|                     d|j        | ||¦  «         |S )a”  Create a greenthread to run ``func(*args, **kwargs)``.  Returns a
    :class:`GreenThread` object which you can use to get the results of the
    call.

    Execution control returns immediately to the caller; the created greenthread
    is merely scheduled to be run at the next available opportunity.
    Use :func:`spawn_after` to  arrange for greenthreads to be spawned
    after a finite delay.
    r   ©r   r   r   r   r   r   )ÚfuncÚargsÚkwargsr   Úgs        r   r   r   2   sA   € õ Œ,‰.Œ.€CÝ�C”LÑ!Ô!€AØ×Ò˜Q ¤¨$°°fÑ=Ô=Ð=Ø€Hó    c                 ó2   — t          d| ||¦  «        d         S )a°  Same as :func:`spawn`, but returns a ``greenlet`` object from
    which it is not possible to retrieve either a return value or
    whether it raised any exceptions.  This is faster than
    :func:`spawn`; it is fastest if there are no keyword arguments.

    If an exception is raised in the function, spawn_n prints a stack
    trace; the print can be disabled by calling
    :func:`eventlet.debug.hub_exceptions` with False.
    r   é   )Ú_spawn_n)r    r!   r"   s      r   r   r   B   s   € õ �A�t˜T 6Ñ*Ô*¨1Ô-Ð-r$   c                 ó�   — t          j        ¦   «         }t          |j        ¦  «        }|                     | |j        |||¦  «         |S )ah  Spawns *func* after *seconds* have elapsed.  It runs as scheduled even if
    the current greenthread has completed.

    *seconds* may be specified as an integer, or a float if fractional seconds
    are desired. The *func* will be called with the given *args* and
    keyword arguments *kwargs*, and will be executed within its own greenthread.

    The return value of :func:`spawn_after` is a :class:`GreenThread` object,
    which can be used to retrieve the results of the call.

    To cancel the spawn and prevent *func* from being called,
    call :meth:`GreenThread.cancel` on the return value of :func:`spawn_after`.
    This will not abort the function if it's already started running, which is
    generally the desired behavior.  If terminating *func* regardless of whether
    it's started or not is the desired behavior, call :meth:`GreenThread.kill`.
    r   ©r   r    r!   r"   r   r#   s         r   r   r   O   sA   € õ" Œ,‰.Œ.€CÝ�C”LÑ!Ô!€AØ×Ò˜W a¤h°°d¸FÑCÔCÐCØ€Hr$   c                 ó�   — t          j        ¦   «         }t          |j        ¦  «        }|                     | |j        |||¦  «         |S )a+  Spawns *func* after *seconds* have elapsed.  The function will NOT be
    called if the current greenthread has exited.

    *seconds* may be specified as an integer, or a float if fractional seconds
    are desired. The *func* will be called with the given *args* and
    keyword arguments *kwargs*, and will be executed within its own greenthread.

    The return value of :func:`spawn_after` is a :class:`GreenThread` object,
    which can be used to retrieve the results of the call.

    To cancel the spawn and prevent *func* from being called,
    call :meth:`GreenThread.cancel` on the return value. This will not abort the
    function if it's already started running.  If terminating *func* regardless
    of whether it's started or not is the desired behavior, call
    :meth:`GreenThread.kill`.
    )r   r   r   r   Úschedule_call_localr   r)   s         r   r   r   f   sA   € õ" Œ,‰.Œ.€CÝ�C”LÑ!Ô!€AØ×Ò˜G Q¤X¨t°T¸6ÑBÔBÐBØ€Hr$   c                 ój   — t          j        dt          d¬¦  «         t          | |||¦  «        d         S )Nzªcall_after_global is renamed to spawn_after, whichhas the same signature and semantics (plus a bit extra).  Please do a quick search-and-replace on your codebase, thanks!é   ©Ú
stacklevelr   )ÚwarningsÚwarnÚDeprecationWarningr'   )r   r    r!   r"   s       r   Úcall_after_globalr3   }   sB   € Ý„Mð	>õ 	 qð	*ñ *ô *ð *õ
 �G˜T 4¨Ñ0Ô0°Ô3Ð3r$   c                 óÈ   — t          j        dt          d¬¦  «         t          j        ¦   «         }t          j        ||j        ¬¦  «        } |j        | |j        g|¢R i |¤Ž}|S )Nzocall_after_local is renamed to spawn_after_local, whichhas the same signature and semantics (plus a bit extra).r-   r.   ©Úparent)r0   r1   r2   r   r   r   r+   r   )r   Úfunctionr!   r"   r   r#   Úts          r   Úcall_after_localr9   †   su   € Ý„Mð	Cå qð*ñ *ô *ð *õ Œ,‰.Œ.€CÝÔ˜(¨3¬<Ð8Ñ8Ô8€AØˆÔ ¨¬ÐC°DÐCÐCÐC¸FÐCÐC€AØ€Hr$   c                 óÐ   — t          j        dt          d¬¦  «         | €t          j        | d„ ¦  «        S t          j        ¦   «         } |j        | t          ¦   «         j	        g|¢R Ž S )NzJInstead of exc_after, which is deprecated, use Timeout(seconds, exception)r-   r.   c                  ó   — d S ©N© r=   r$   r   ú<lambda>zexc_after.<locals>.<lambda>™   s   € ¨D€ r$   )
r0   r1   r2   r	   ÚTimerr   r   r+   r   Úthrow)r   Ú
throw_argsr   s      r   Ú	exc_afterrB   ”   so   € Ý„Mð 0å$°ð4ñ 4ô 4ð 4ð €ÝŒ{˜7 L LÑ1Ô1Ð1Ý
Œ,‰.Œ.€CØ"ˆ3Ô" 7­J©L¬LÔ,>ÐLÀÐLÐLÐLÐLr$   c              #   óZ   K  — | ]&\  }}} t          j        ||¦  «        |¦  «        V — Œ'd S r<   )r   Úwrap_deprecated)Ú.0ÚoldÚnewÚfuns       r   ú	<genexpr>rI   Ÿ   sQ   è è € ð ð Ù/<¨s°C¸Ð%…GÔ˜C Ñ%Ô% cÑ*Ô*ðð ð ð ð ð r$   zgreenthread.TimeoutErrorÚTimeoutzgreenthread.with_timeoutÚwith_timeoutc                 ó”   — t          j        ¦   «         }t          j        ||j        ¬¦  «        } |j        | |j        g|¢R i |¤Ž}||fS )Nr5   )r   r   r   r   r   )r   r    r!   r"   r   r#   r8   s          r   r'   r'   ¦   sS   € Ý
Œ,‰.Œ.€CÝÔ˜$ s¤|Ð4Ñ4Ô4€AØ ˆÔ  ¨!¬(ÐD°TÐDÐDÐD¸VÐDÐD€AØˆaˆ4€Kr$   c                   óH   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ ZdS )r   zéThe GreenThread class is a type of Greenlet which has the additional
    property of being able to retrieve the return value of the main function.
    Do not construct GreenThread objects directly; call :func:`spawn` to get one.
    c                 óž   — t           j                              | | j        |¦  «         t          j        ¦   «         | _        d| _        d | _        d S )NF)r   Ú__init__Úmainr   ÚEventÚ_exit_eventÚ_resolving_linksÚ_exit_funcs)Úselfr6   s     r   rO   zGreenThread.__init__³   sC   € ÝÔ×"Ò" 4¨¬°FÑ;Ô;Ð;Ý œ;™=œ=ˆÔØ %ˆÔØˆÔÐÐr$   c                 ó8  ‡ ‡— ddl m} t          j        ¦   «         }t	          ||¦  «        st          d¦  «        ‚|j                             ¦   «         Šˆ fd„}‰                     |¦  «         ˆfd„}‰  	                    |¦  «         ‰ 
                    ¦   «         S )zS
        Enable ``GreenThread``s to be ``await``ed in ``async`` functions.
        r   )ÚHubzmThis API only works with eventlet's asyncio hub. To use it, set an EVENTLET_HUB=asyncio environment variable.c                 ón   •— |                       ¦   «         r‰j        s‰                     ¦   «          d S d S d S r<   )Ú	cancelledÚdeadr   )ÚfuturerU   s    €r   Úgot_future_resultz0GreenThread.__await__.<locals>.got_future_resultÈ   sE   ø€ Ø×ÒÑ!Ô!ð ¨$¬)ð à—	’	‘”���ðð ð ð r$   c                 ó"  •— ‰                      ¦   «         rd S 	 |                      ¦   «         }‰                     |¦  «         d S # t          $ r ‰                     ¦   «          Y d S t
          $ r }‰                     |¦  «         Y d }~d S d }~ww xY wr<   )ÚdoneÚwaitÚ
set_resultr   r   ÚBaseExceptionÚset_exception)ÚgthreadÚresultÚer[   s      €r   Úgot_gthread_resultz1GreenThread.__await__.<locals>.got_gthread_resultÐ   s®   ø€ Ø�{Š{‰}Œ}ð à�ð(à Ÿš™œ�Ø×!Ò! &Ñ)Ô)Ð)Ð)Ð)øÝð  ð  ð  Ø—’‘”����Ý ð (ð (ð (Ø×$Ò$ QÑ'Ô'Ð'Ð'Ð'Ð'Ð'Ð'Ð'øøøøð(øøøs   ™)A ÁBÁ%	BÁ.B	Â	B)Úeventlet.hubs.asynciorW   r   r   Ú
isinstancer   ÚloopÚcreate_futureÚadd_done_callbackÚlinkÚ	__await__)rU   rW   r   r\   rf   r[   s   `    @r   rm   zGreenThread.__await__¹   sÒ   øø€ ð 	.Ð-Ð-Ð-Ð-Ð-ÝŒl‰nŒnˆÝ˜#˜sÑ#Ô#ð 	ÝðQñô ð ð
 ”×'Ò'Ñ)Ô)ˆð	ð 	ð 	ð 	ð 	ð
 	× Ò Ð!2Ñ3Ô3Ð3ð	(ð 	(ð 	(ð 	(ð 	(ð 	�	Š	Ð$Ñ%Ô%Ð%à×ÒÑ!Ô!Ð!r$   c                 ó4   — | j                              ¦   «         S )aH   Returns the result of the main function of this GreenThread.  If the
        result is a normal return value, :meth:`wait` returns it.  If it raised
        an exception, :meth:`wait` will raise the same exception (though the
        stack trace will unavoidably contain some frames from within the
        greenthread module).)rR   r_   )rU   s    r   r_   zGreenThread.waitâ   s   € ð Ô×$Ò$Ñ&Ô&Ð&r$   c                 óÒ   — | j         €t          ¦   «         | _         | j                              |||f¦  «         | j                             ¦   «         r|                      ¦   «          dS dS )aÓ   Set up a function to be called with the results of the GreenThread.

        The function must have the following signature::

            def func(gt, [curried args/kwargs]):

        When the GreenThread finishes its run, it calls *func* with itself
        and with the `curried arguments <http://en.wikipedia.org/wiki/Currying>`_ supplied
        at link-time.  If the function wants to retrieve the result of the GreenThread,
        it should call wait() on its first argument.

        Note that *func* is called within execution context of
        the GreenThread, so it is possible to interfere with other linked
        functions by doing things like switching explicitly to another
        greenthread.
        N)rT   r   ÚappendrR   ÚreadyÚ_resolve_links©rU   r    Úcurried_argsÚcurried_kwargss       r   rl   zGreenThread.linkê   sp   € ð" ÔÐ#Ý$™wœwˆDÔØÔ×Ò  |°^Ð DÑEÔEÐEØÔ×!Ò!Ñ#Ô#ð 	"Ø×ÒÑ!Ô!Ð!Ð!Ð!ð	"ð 	"r$   c                 óv   — | j         sdS 	 | j                              |||f¦  «         dS # t          $ r Y dS w xY w)zn remove linked function set by :meth:`link`

        Remove successfully return True, otherwise False
        FT)rT   ÚremoveÚ
ValueErrorrs   s       r   ÚunlinkzGreenThread.unlink  s^   € ð
 Ôð 	Ø�5ð	ØÔ×#Ò# T¨<¸Ð$HÑIÔIÐIØ�4øÝð 	ð 	ð 	Ø�5�5ð	øøøs   ‹* ª
8·8c                 óè   — 	  ||i |¤Ž}| j                              |¦  «         |                      ¦   «          d S #   | j         j        t	          j        ¦   «         Ž  |                      ¦   «          ‚ xY wr<   )rR   Úsendrr   Úsend_exceptionÚsysÚexc_info)rU   r7   r!   r"   rd   s        r   rP   zGreenThread.main  sƒ   € ð	"Ø�X˜tÐ. vÐ.Ð.ˆFð Ô×!Ò! &Ñ)Ô)Ð)Ø×ÒÑ!Ô!Ð!Ð!Ð!øð	Ø+ˆDÔÔ+­S¬\©^¬^Ð<Ð<Ø×ÒÑ!Ô!Ð!Øøøøs	   ‚: º7A1c                 óÎ   — | j         rd S | j        sd S d| _         	 | j        r0| j                             ¦   «         \  }}} || g|¢R i |¤Ž | j        °0d| _         d S # d| _         w xY w)NTF)rS   rT   Úpopleft)rU   ÚfÚcaÚckws       r   rr   zGreenThread._resolve_links  s¥   € àÔ ð 	ØˆFØÔð 	ØˆFØ $ˆÔð	*ØÔ"ð $Ø!Ô-×5Ò5Ñ7Ô7‘
��2�sØ��$Ð#˜Ð#Ð#Ð#˜sÐ#Ð#Ð#ð Ô"ð $ð %*ˆDÔ!Ð!Ð!ø EˆDÔ!Ð)Ð)Ð)Ð)s   ›7A Á	A$c                 ó   — t          | g|¢R Ž S )z²Kills the greenthread using :func:`kill`.  After being killed
        all calls to :meth:`wait` will raise *throw_args* (which default
        to :class:`greenlet.GreenletExit`).©r   ©rU   rA   s     r   r   zGreenThread.kill'  s   € õ �DÐ&˜:Ð&Ð&Ð&Ð&r$   c                 ó   — t          | g|¢R Ž S )zìKills the greenthread using :func:`kill`, but only if it hasn't
        already started running.  After being canceled,
        all calls to :meth:`wait` will raise *throw_args* (which default
        to :class:`greenlet.GreenletExit`).)r   r†   s     r   r   zGreenThread.cancel-  s   € õ
 �dÐ(˜ZÐ(Ð(Ð(Ð(r$   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rO   rm   r_   rl   ry   rP   rr   r   r   r=   r$   r   r   r   ­   s¦   € € € € € ðð ð
 ð  ð  ð'"ð '"ð '"ðR'ð 'ð 'ð"ð "ð "ð.ð ð ð	"ð 	"ð 	"ð*ð *ð *ð'ð 'ð 'ð)ð )ð )ð )ð )r$   r   c                 ó(   — | st          | g|¢R Ž  dS dS )z¶Like :func:`kill`, but only terminates the greenthread if it hasn't
    already started execution.  If the grenthread has already started
    execution, :func:`cancel` has no effect.Nr…   )r#   rA   s     r   r   r   5  s2   € ð ð ÝˆQÐ�ÐÐÐÐÐÐðð r$   c                 óf  ‡— | j         rdS t          j        ¦   «         }| sAˆfd„}|| _        t	          | t
          ¦  «        r 	 |                      |di ¦  «         n#  Y nxY wt          ¦   «         }||j        ur/| 	                    ¦   «          | 
                    d|j        ¦  «          | j        ‰Ž  dS )aê  Terminates the target greenthread by raising an exception into it.
    Whatever that greenthread might be doing; be it waiting for I/O or another
    primitive, it sees an exception right away.

    By default, this exception is GreenletExit, but a specific exception
    may be specified.  *throw_args* should be the same as the arguments to
    raise; either an exception instance or an exc_info tuple.

    Calling :func:`kill` causes the calling greenthread to cooperatively yield.
    Nc                  óp   •— ‰r!‰d                               ‰d         ¦  «        ‚t          j        ¦   «         ‚)Nr&   r-   )Úwith_tracebackr   r   )ÚaÚkwrA   s     €r   Ú
just_raisezkill.<locals>.just_raiseO  s6   ø€ Øð .Ø  ”m×2Ò2°:¸a´=ÑAÔAÐAåÔ+Ñ-Ô-Ð-r$   r=   r   )rZ   r   r   Úrunrh   r   rP   r   r   Úensure_greenletr   r   r@   )r#   rA   r   r’   r   s    `   r   r   r   =  sÜ   ø€ ð 	„vð ØˆÝ
Œ,‰.Œ.€CØð ð	.ð 	.ð 	.ð 	.ð 	.ð
 ˆŒÝ�a�Ñ%Ô%ð 	ðØ—’�z 2 rÑ*Ô*Ð*Ð*øðØ�øøøÝ‰lŒl€GØ�c”lÐ"Ð"à×ÒÑÔÐØ× Ò   G¤NÑ3Ô3Ð3Ø€A„GˆZÐÐÐÐs   ÁA ÁA)r   )!Úcollectionsr   r}   r   r   Úeventletr   r   r   r   Úeventlet.hubsr	   Úeventlet.supportr
   r0   Ú__all__r   r   r   r   r   r   r3   r9   Ú
call_afterrB   rJ   rK   ÚTimeoutErrorr'   r   r   r   r=   r$   r   ú<module>rœ      sõ  ðØ Ð Ð Ð Ð Ð Ø 
€
€
€
à !Ð !Ð !Ð !Ð !Ð !à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø €€€ð>ð >ð >€ð Ô €
ðð ð ð ð:ð ð ð 
.ð 
.ð 
.ðð ð ð.ð ð ð.4ð 4ð 4ðð ð ð €
ðMð Mð Mðð à	# Y°´Ð@Ø	# ^°WÔ5IÐJðAðñ ô Ñ €ˆlðð ð ðE)ð E)ð E)ð E)ð E)�(Ô#ñ E)ô E)ð E)ðPð ð ð$ð $ð $ð $ð $r$   