+
    VBi                     L    R t R.t ! R R4      t ! R R4      t ! R R4      tR# )a  
Helper for looping over sequences, particular in templates.

Often in a loop in a template it's handy to know what's next up,
previously up, if this is the first or last item in the sequence, etc.
These can be awkward to manage in a normal Python loop, but using the
looper you can get a better sense of the context.  Use like::

    >>> for loop, item in looper(['a', 'b', 'c']):
    ...     print loop.number, item
    ...     if not loop.last:
    ...         print '---'
    1 a
    ---
    2 b
    ---
    3 c

looperc                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )r   z
Helper for looping (particularly in templates)

Use this like::

    for loop, item in looper(seq):
        if loop.first:
            ...
c                    Wn         R # Nseqselfr   s   &&;/usr/lib/python3.14/site-packages/Cython/Tempita/_looper.py__init__looper.__init__#   s        c                ,    \        V P                  4      # r   )looper_iterr   r	   s   &r
   __iter__looper.__iter__&   s    488$$r   c                T    R V P                   P                  : RV P                  : R2# )<z for >)	__class____name__r   r   s   &r
   __repr__looper.__repr__)   s    NN##TXX/ 	/r   r   N)
r   
__module____qualname____firstlineno____doc__r   r   r   __static_attributes____classdictcell____classdict__s   @r
   r   r      s     %/ /r   c                   2   a  ] tR t^.t o R tR tR tRtV tR# )r   c                4    \        V4      V n        ^ V n        R#     N)listr   posr   s   &&r
   r   looper_iter.__init__0   s    9r   c                    V # r    r   s   &r
   r   looper_iter.__iter__4   s    r   c                   V P                   \        V P                  4      8  d   \        h\	        V P                  V P                   4      V P                  V P                   ,          3pV ;P                   ^,          un         V#    )r'   lenr   StopIterationloop_pos)r	   results   & r
   __next__looper_iter.__next__7   sT    88s488}$$((DHH-txx/AAAr   r'   r   N)	r   r   r   r   r   r   r3   r   r   r    s   @r
   r   r   .   s      r   r   c                   "  a  ] tR t^?t o R tR tR t]! ]4      tR t]! ]4      tR t	]! ]	4      t	R t
]! ]
4      t
R t]! ]4      tR t]! ]4      tR	 t]! ]4      tR
 t]! ]4      tR t]! ]4      tR t]! ]4      tRR ltRR ltR tRtV tR# )r1   c                    Wn         W n        R # r   r   r'   )r	   r   r'   s   &&&r
   r   loop_pos.__init__A   s    r   c                b    R V P                   V P                  ,          : RV P                  : R2# )z
<loop pos=z at r   r8   r   s   &r
   r   loop_pos.__repr__E   s%    HHTXX* 	*r   c                    V P                   # r   r'   r   s   &r
   indexloop_pos.indexI   s    xxr   c                (    V P                   ^,           # r-   r=   r   s   &r
   numberloop_pos.numberM       xx!|r   c                <    V P                   V P                  ,          # r   r8   r   s   &r
   itemloop_pos.itemQ   s    xx!!r   c                p     V P                   V P                  ^,           ,          #   \         d     R# i ; i)r.   N)r   r'   
IndexErrorr   s   &r
   r3   loop_pos.__next__U   s0    	88DHHqL)) 		s   #& 55c                p    V P                   ^ 8X  d   R# V P                  V P                   ^,
          ,          # r$   r5   r   s   &r
   previousloop_pos.previous\   s'    88q=xx1%%r   c                2    V P                   ^,          '       * #    r=   r   s   &r
   oddloop_pos.oddb   s    88a<r   c                (    V P                   ^,          # rN   r=   r   s   &r
   evenloop_pos.evenf   rC   r   c                     V P                   ^ 8H  # )r%   r=   r   s   &r
   firstloop_pos.firstj   s    xx1}r   c                T    V P                   \        V P                  4      ^,
          8H  # r-   )r'   r/   r   r   s   &r
   lastloop_pos.lastn   s    xx3txx=1,,,r   c                ,    \        V P                  4      # r   )r/   r   r   s   &r
   lengthloop_pos.lengthr   s    488}r   Nc                x    V P                   '       d   R# V P                  V P                  V P                  V4      # )z
Returns true if this item is the start of a new group,
where groups mean that some attribute has changed.  The getter
can be None (the item itself changes), an attribute name like
``'.attr'``, a function, or a dict key or list index.
T)rV   _compare_grouprE   rK   r	   getters   &&r
   first_grouploop_pos.first_groupv   s-     :::""499dmmVDDr   c                x    V P                   '       d   R# V P                  V P                  V P                  V4      # )z
Returns true if this item is the end of a new group,
where groups mean that some attribute has changed.  The getter
can be None (the item itself changes), an attribute name like
``'.attr'``, a function, or a dict key or list index.
T)rY   r_   rE   r3   r`   s   &&r
   
last_grouploop_pos.last_group   s-     999""499dmmVDDr   c                   Vf   W8g  # \        V\        4      '       du   VP                  R4      '       d^   VR,          pVP                  R4      '       d'   VR R p\	        W4      ! 4       \	        W#4      ! 4       8g  # \	        W4      \	        W#4      8g  # \        VR4      '       d   V! V4      V! V4      8g  # W,          W#,          8g  # )N.:r.   NNz()__call__)
isinstancestr
startswithendswithgetattrhasattr)r	   rE   otherra   s   &&&&r
   r_   loop_pos._compare_group   s    >= %%##C((BZFt$$t,.'%2H2JJJt,0FFFVZ(($<6%=00<5=00r   r5   r   )r   r   r   r   r   r   r>   propertyrA   rE   r3   rK   rP   rS   rV   rY   r\   rb   re   r_   r   r   r    s   @r
   r1   r1   ?   s     *UOEfF"D>D
 !H& !H 
3-CD>DUOE-D>DfF	E	E1 1r   r1   N)r   __all__r   r   r1   r*   r   r
   <module>ru      s3   ( */ /, "[1 [1r   