
    thP                     (     G d  d          Z ddZdS )c                   *    e Zd ZdZd Zd Zd Zd ZdS )Iteratora-  
    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                     t          |d          sd}t          |          || _        t          | j        dd          | _        d S )Nseekzim must have seek method
_min_frame    )hasattrAttributeErrorimgetattrposition)selfr
   msgs      e/var/www/html/mycamper/aliexpress-site/backend/venv/lib/python3.11/site-packages/PIL/ImageSequence.py__init__zIterator.__init__   sG    r6"" 	&,C %%%q99    c                 z    	 | j                             |           | j         S # t          $ r}t          |d }~ww xY wN)r
   r   EOFError
IndexError)r   ixes      r   __getitem__zIterator.__getitem__&   sI    	$GLL7N 	$ 	$ 	$!#	$s    # 
:5:c                     | S r    )r   s    r   __iter__zIterator.__iter__-   s    r   c                     	 | j                             | j                   | xj        dz  c_        | j         S # t          $ r}t          |d }~ww xY w)N   )r
   r   r   r   StopIteration)r   r   s     r   __next__zIterator.__next__0   s[    	'GLL'''MMQMM7N 	' 	' 	'Q&	's   58 
AA

AN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r      sZ        	 	: : :$ $ $  ' ' ' ' 'r   r   Nc                     t          | t                    s| g} g }| D ]G}|                                }|d t          |          D             z  }|                    |           Hrfd|D             n|S )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.
    c                 6    g | ]}|                                 S r   )copy).0im_frames     r   
<listcomp>zall_frames.<locals>.<listcomp>I   s     EEEHEEEr   c                 &    g | ]} |          S r   r   )r'   r
   funcs     r   r)   zall_frames.<locals>.<listcomp>L   s!    ###DDHH###r   )
isinstancelisttellr   r   )r
   r+   ims
imSequencecurrents    `   r   
all_framesr2   9   s     b$ T
C ! !
//##EE0D0DEEEE    '+4####s####4r   r   )r   r2   r   r   r   <module>r3      sL   &#' #' #' #' #' #' #' #'L5 5 5 5 5 5r   