§
    ¯õiÔ
  ã                  óÆ   — d dl m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
mZmZ erd dlmZ ej         ej        d	d	¬
¦  «         G d„ d¦  «        ¦   «         ¦   «         ZdS )é    )Úannotations)Údefaultdict)Úasynccontextmanager)ÚTYPE_CHECKINGNé   )ÚEventÚ_coreÚ_util)ÚAsyncIteratorF)ÚeqÚslotsc                  ó¸   — e Zd ZU dZ ej        d„ d¬¦  «        Zded<    ej        ed¬¦  «        Z	ded<    ej        dd¬	¦  «        Z
d
ed<   edd„¦   «         ZdS )Ú	SequenceraØ  A convenience class for forcing code in different tasks to run in an
    explicit linear order.

    Instances of this class implement a ``__call__`` method which returns an
    async context manager. The idea is that you pass a sequence number to
    ``__call__`` to say where this block of code should go in the linear
    sequence. Block 0 starts immediately, and then block N doesn't start until
    block N-1 has finished.

    Example:
      An extremely elaborate way to print the numbers 0-5, in order::

         async def worker1(seq):
             async with seq(0):
                 print(0)
             async with seq(4):
                 print(4)

         async def worker2(seq):
             async with seq(2):
                 print(2)
             async with seq(5):
                 print(5)

         async def worker3(seq):
             async with seq(1):
                 print(1)
             async with seq(3):
                 print(3)

         async def main():
            seq = trio.testing.Sequencer()
            async with trio.open_nursery() as nursery:
                nursery.start_soon(worker1, seq)
                nursery.start_soon(worker2, seq)
                nursery.start_soon(worker3, seq)

    c                 ó*   — t          t          ¦  «        S )N)r   r   © ó    úc/var/www/html/nodeJS/PythonScripts/venv3.11/lib/python3.11/site-packages/trio/testing/_sequencer.pyú<lambda>zSequencer.<lambda>:   s   € �¥EÑ*Ô*€ r   F)ÚfactoryÚinitzdefaultdict[int, Event]Ú_sequence_pointszset[int]Ú_claimed)Údefaultr   ÚboolÚ_brokenÚpositionÚintÚreturnúAsyncIterator[None]c               óx  K  — || j         v rt          d|› �¦  «        ‚| j        rt          d¦  «        ‚| j                              |¦  «         |dk    r—	 | j        |                              ¦   «         ƒ d {V —† | j        rt          d¦  «        ‚nZ# t          j        $ rH d| _        | j                             ¦   «         D ]}| 	                    ¦   «          Œt          d¦  «        d ‚w xY w	 d W V — | j        |dz             	                    ¦   «          d S # | j        |dz             	                    ¦   «          w xY w)Nz"Attempted to reuse sequence point zsequence broken!r   Tz+Sequencer wait cancelled -- sequence brokené   )
r   ÚRuntimeErrorr   Úaddr   Úwaitr	   Ú	CancelledÚvaluesÚset)Úselfr   Úevents      r   Ú__call__zSequencer.__call__@   sv  è è € à�t”}Ð$Ð$ÝÐNÀHÐNÐNÑOÔOÐOØŒ<ð 	3ÝÐ1Ñ2Ô2Ð2ØŒ×Ò˜(Ñ#Ô#Ð#Ø�qŠ=ˆ=ð;ØÔ+¨HÔ5×:Ò:Ñ<Ô<Ð<Ð<Ð<Ð<Ð<Ð<Ð<ð ”<ð ;Ý&Ð'9Ñ:Ô:Ð:ð;øõ ”?ð ð ð Ø#�”Ø!Ô2×9Ò9Ñ;Ô;ð  ð  �EØ—I’I‘K”K�K�KÝ"ØAñô àðð	øøøð	6ØˆEˆEˆEˆEàÔ! (¨Q¡,Ô/×3Ò3Ñ5Ô5Ð5Ð5Ð5øˆDÔ! (¨Q¡,Ô/×3Ò3Ñ5Ô5Ð5Ð5øøøs   Á%B ÂAC(Ã,D Ä$D9N)r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚattrsÚfieldr   Ú__annotations__r'   r   r   r   r*   r   r   r   r   r      s¾   € € € € € € ð%ð %ðN 1<°´Ø*Ð*Øð1ñ 1ô 1Ðð ð ð ñ ð %˜œ¨S°uÐ=Ñ=Ô=€HÐ=Ð=Ð=Ñ=Ø�E”K¨°EÐ:Ñ:Ô:€GÐ:Ð:Ð:Ñ:àð6ð 6ð 6ñ Ôð6ð 6ð 6r   r   )Ú
__future__r   Úcollectionsr   Ú
contextlibr   Útypingr   r/   Ú r   r	   r
   Úcollections.abcr   ÚfinalÚdefiner   r   r   r   ú<module>r:      sô   ðØ "Ð "Ð "Ð "Ð "Ð "à #Ð #Ð #Ð #Ð #Ð #Ø *Ð *Ð *Ð *Ð *Ð *Ø  Ð  Ð  Ð  Ð  Ð  à €€€à "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "àð .Ø-Ð-Ð-Ð-Ð-Ð-ð „Ø€„�˜eÐ$Ñ$Ô$ðF6ð F6ð F6ð F6ð F6ñ F6ô F6ñ %Ô$ñ „ðF6ð F6ð F6r   