Ë
    Z²jI  ã                   ó^   — d Z ddlZddlmZ ddlmZ  ed«      Zdee   dedeee      fd	„Zy)
z9Contains a utility to iterate by chunks over an iterator.é    N)ÚIterable)ÚTypeVarÚTÚiterableÚ
chunk_sizeÚreturnc              #   óú   K  — t        |t        «      r|dk  rt        d«      ‚t        | «      }	 	 t	        |«      }t        j                  |ft        j                  ||dz
  «      «      –— Œ=# t
        $ r Y yw xY w­w)aq  Iterates over an iterator chunk by chunk.

    Taken from https://stackoverflow.com/a/8998040.
    See also https://github.com/huggingface/huggingface_hub/pull/920#discussion_r938793088.

    Args:
        iterable (`Iterable`):
            The iterable on which we want to iterate.
        chunk_size (`int`):
            Size of the chunks. Must be a strictly positive integer (e.g. >0).

    Example:

    ```python
    >>> from huggingface_hub.utils import chunk_iterable

    >>> for items in chunk_iterable(range(17), chunk_size=8):
    ...     print(items)
    # [0, 1, 2, 3, 4, 5, 6, 7]
    # [8, 9, 10, 11, 12, 13, 14, 15]
    # [16] # smaller last chunk
    ```

    Raises:
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If `chunk_size` <= 0.

    > [!WARNING]
    > The last chunk can be smaller than `chunk_size`.
    r   z6`chunk_size` must be a strictly positive integer (>0).Né   )	Ú
isinstanceÚintÚ
ValueErrorÚiterÚnextÚStopIterationÚ	itertoolsÚchainÚislice)r   r   ÚiteratorÚ	next_items       úa/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/huggingface_hub/utils/_chunk_utils.pyÚchunk_iterabler      s}   è ø€ ô> �j¤#Ô&¨*¸ª/ÜÐQÓRÐRä�H‹~€HØ
ð	Ü˜X›ˆIô �o‰o˜y˜l¬I×,<Ñ,<¸XÀzÐTUÁ~Ó,VÓWÒWð øô ò 	Ùð	üs'   ‚-A;°A, »1A;Á,	A8Á5A;Á7A8Á8A;)	Ú__doc__r   Úcollections.abcr   Útypingr   r   r   r   © ó    r   ú<module>r      sK   ðñ @ã Ý $Ý ñ ˆCƒL€ð(X˜X a™[ð (X°cð (X¸hÀxÐPQÁ{Ñ>Sô (Xr   