§
    }ŠtjI  ã                   óx   — 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dS )
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	          |¦  «        }n# t
          $ r Y dS w xY wt          j        |ft          j        ||dz
  ¦  «        ¦  «        V — ŒQ)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).TNé   )	Ú
isinstanceÚintÚ
ValueErrorÚiterÚnextÚStopIterationÚ	itertoolsÚchainÚislice)r   r   ÚiteratorÚ	next_items       ú`/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/huggingface_hub/utils/_chunk_utils.pyÚchunk_iterabler      s©   è è € õ> �j¥#Ñ&Ô&ð S¨*¸ª/¨/ÝÐQÑRÔRÐRå�H‰~Œ~€HðXð	Ý˜X™œˆIˆIøÝð 	ð 	ð 	ØˆFˆFð	øøøåŒo˜y˜l­IÔ,<¸XÀzÐTUÁ~Ñ,VÔ,VÑWÔWÐWÐWÐWðXs   ¾A Á
AÁA)	Ú__doc__r   Úcollections.abcr   Útypingr   r   r   r   © ó    r   ú<module>r      s—   ðð @Ð ?à Ð Ð Ð Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð ð €GˆC�L„L€ð(X˜X aœ[ð (X°cð (X¸hÀxÐPQÄ{Ô>Sð (Xð (Xð (Xð (Xð (Xð (Xr   