
    ?_                         d dl mZmZmZ ddlmZ ddlmZ ddlm	Z	  ed          Z
dede	e
         d	ee
         fd
Zde	e
         ded	eee
                  fdZdS )    )AsyncIterableListTypeVar   )iter)islice)AnyIterableTniterablereturnc                 p   K   | dk     rt          d          d t          ||           2              d{V S )a  
    Return the first n items of iterable as a list.

    If there are too few items in iterable, all of them are returned.
    n needs to be at least 0. If it is 0, an empty list is returned.

    Example:

        first_two = await take(2, [1, 2, 3, 4, 5])

    r   z(take's first parameter can't be negativec                 "   K   g | 3 d {V }|
6 S )N ).0items     ;lib/python3.11/site-packages/aioitertools/more_itertools.py
<listcomp>ztake.<locals>.<listcomp>   s.      777777774D7777s   N)
ValueErrorr   )r   r   s     r   taker      sP       	1uuCDDD776(A#6#67777777777    c                   K   t          |           }t          ||           d{V }|g k    r#|W V  t          ||           d{V }|g k    !dS dS )a"  
    Break iterable into chunks of length n.

    The last chunk will be shorter if the total number of items is not
    divisible by n.

    Example:

        async for chunk in chunked([1, 2, 3, 4, 5], n=2):
            ...  # first iteration: chunk == [1, 2]; last one: chunk == [5]
    N)r   r   )r   r   itchunks       r   chunkedr      sx       
hBq"++E
2++1bkk!!!!!! 2++++++r   N)typingr   r   r   builtinsr   	itertoolsr   typesr	   r
   intr   r   r   r   r   <module>r!      s    0 / / / / / / / / /                  GCLL8# 8Q 8DG 8 8 8 8""KN "s "}T!W7M " " " " " "r   