Ë
    _§1hÔ
  ã                  óÀ   — 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y)é    )Ú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y)Ú	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   © ó    úU/var/www/skyplay_api_hub/venv/lib/python3.12/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Ú_brokenc               óx  K  — || j                   v rt        d|› �«      ‚| j                  rt        d«      ‚| j                   j                  |«       |dk7  r=	 | j                  |   j                  «       ƒ d {  –—†  | j                  rt        d«      ‚	 d ­–— | j                  |dz      j                  «        y 7 ŒB# t        j                  $ rC d| _        | j                  j                  «       D ]  }|j                  «        Œ t        d«      d ‚w xY w# | j                  |dz      j                  «        w xY w­w)Nz"Attempted to reuse sequence point zsequence broken!r   Tz+Sequencer wait cancelled -- sequence brokené   )
r   ÚRuntimeErrorr   Úaddr   Úwaitr	   Ú	CancelledÚvaluesÚset)ÚselfÚpositionÚevents      r   Ú__call__zSequencer.__call__@   s!  è ø€ à�t—}‘}Ñ$ÜÐ!CÀHÀ:ÐNÓOÐOØ�<Š<ÜÐ1Ó2Ð2Ø�‰×Ñ˜(Ô#Ø�qŠ=ð;Ø×+Ñ+¨HÑ5×:Ñ:Ó<×<Ð<ð —<’<Ü&Ð'9Ó:Ð:ð	6Üà×!Ñ! (¨Q¡,Ñ/×3Ñ3Õ5ð =ùÜ—?‘?ò Ø#�”Ø!×2Ñ2×9Ñ9Ó;ò  �EØ—I‘I•Kð ä"ØAóàðð	ûð ×!Ñ! (¨Q¡,Ñ/×3Ñ3Õ5üsI   ‚AD:Á B< Á7B:Á8B< Á<D:ÂD Â!D:Â:B< Â<ADÄD:Ä"D7Ä7D:N)r%   ÚintÚreturnzAsyncIterator[None])Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚattrsÚfieldr   Ú__annotations__r#   r   r   r   r'   r   r   r   r   r      sk   … ñ%ðN 1<°·±Ù*Øô1ÐÐ-ó ð %˜Ÿ™¨S°uÔ=€HˆhÓ=Ø�E—K‘K¨°EÔ:€GˆTÓ:àò6ó ñ6r   r   )Ú
__future__r   Úcollectionsr   Ú
contextlibr   Útypingr   r.   Ú r   r	   r
   Úcollections.abcr   ÚfinalÚdefiner   r   r   r   ú<module>r9      sU   ðÝ "å #Ý *Ý  ã ç "Ñ "áÝ-ð ‡�Ø€‡��˜eÔ$÷F6ð F6ó %ó ñF6r   