
    \i                    h    S SK Jr  SSKJr  Sr\(       a  S SKJr   " S S5      r S
     SS	 jjrg)    )annotations   )ImageF)Callablec                  @    \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)Iterator   a  
This class implements an iterator object that can be used to loop
over an image sequence.

You can use the ``[]`` operator to access elements by index. This operator
will raise an :py:exc:`IndexError` if you try to access a nonexistent
frame.

:param im: An image object.
c                    [        US5      (       d  Sn[        U5      eXl        [        U R                  SS5      U l        g )Nseekzim must have seek method
_min_framer   )hasattrAttributeErrorimgetattrposition)selfr   msgs      T/var/www/html/kml_chatgpt/mouzaenv/lib/python3.13/site-packages/PIL/ImageSequence.py__init__Iterator.__init__&   s8    r6"",C %%q9    c                     U R                   R                  U5        U R                   $ ! [         a  nSn[        U5      UeS nAff = f)Nend of sequence)r   r   EOFError
IndexError)r   ixer   s       r   __getitem__Iterator.__getitem__-   sA    	)GGLL77N 	)#CS/q(	)s   &) 
AAAc                    U $ N )r   s    r   __iter__Iterator.__iter__5   s    r   c                     U R                   R                  U R                  5        U =R                  S-  sl        U R                   $ ! [         a  nSn[	        U5      UeS nAff = f)Nr   r   )r   r   r   r   StopIteration)r   r   r   s      r   __next__Iterator.__next__8   sT    	,GGLL'MMQM77N 	,#C$!+	,s   AA 
A%A  A%)r   r   N)r   Image.ImagereturnNone)r   intr*   r)   )r*   r   )r*   r)   )
__name__
__module____qualname____firstlineno____doc__r   r   r#   r'   __static_attributes__r"   r   r   r   r      s    	:),r   r   Nc                8   [        U [        5      (       d  U /n / nU  HP  nUR                  5       nU[        U5       Vs/ s H  oUR	                  5       PM     sn-  nUR                  U5        MR     U(       a  U V s/ s H
  o" U 5      PM     sn $ U$ s  snf s  sn f )a  
Applies a given function to all frames in an image or a list of images.
The frames are returned as a list of separate images.

:param im: An image, or a list of images.
:param func: The function to apply to all of the image frames.
:returns: A list of images.
)
isinstancelisttellr   copyr   )r   funcims
imSequencecurrentim_frames         r   
all_framesr=   B   s     b$T
C
//#0DE0DH0DEE   (,s#sDHs#44 F $s   B<Br!   )r   zImage.Image | list[Image.Image]r8   z+Callable[[Image.Image], Image.Image] | Noner*   zlist[Image.Image])	
__future__r    r   TYPE_CHECKINGcollections.abcr   r   r=   r"   r   r   <module>rB      sG   " # (%, %,T 9=5'5
55 5r   