o
    -wÖi`	  ã                   @  sš   d dl mZ d dlmZmZmZmZmZmZ er*edƒZ	ee
e	 ee
e	 df f Zedddd„ƒZedddd„ƒZeeffddd„Z		dddd„ZdS )é    )Úannotations)ÚTYPE_CHECKINGÚAnyÚIterableÚTypeVarÚUnionÚoverloadÚT.ÚobjúIterable[T]Ú	base_typeÚ	ClassInfoÚreturnúlist[T]c                 C  ó   d S ©N© ©r
   r   r   r   úM/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/wandb/_iterutils.pyÚalways_list
   ó   r   c                 C  r   r   r   r   r   r   r   r      r   r   c                 C  s   t | |ƒr| gS t| ƒS )at  Return a guaranteed list of objects from a single instance OR iterable of such objects.

    By default, assume the returned list should have string-like elements (i.e. `str`/`bytes`).

    Adapted from `more_itertools.always_iterable`, but simplified for internal use.  See:
    https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.always_iterable
    )Ú
isinstanceÚlistr   r   r   r   r      s   NÚiterableÚ	too_shortú"type[Exception] | Exception | NoneÚtoo_longc                 C  sd   t | ƒ}zt|ƒ}W n ty   |ptdƒd‚w zt|ƒ}W n ty*   | Y S w |p0tdƒd‚)a  Return the only item in the iterable.

    Note:
        This is intended **only** as an internal helper/convenience function,
        and its implementation is directly adapted from `more_itertools.one`.
        Users needing similar functionality are strongly encouraged to use
        that library instead:
        https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.one

    Args:
        iterable: The iterable to get the only item from.
        too_short: Custom exception to raise if the iterable has no items.
        too_long: Custom exception to raise if the iterable has multiple items.

    Raises:
        ValueError or `too_short`: If the iterable has no items.
        ValueError or `too_long`: If the iterable has multiple items.
    z"Expected 1 item in iterable, got 0Nz)Expected 1 item in iterable, got multiple)ÚiterÚnextÚStopIterationÚ
ValueError)r   r   r   Úitr
   Ú_r   r   r   Úone   s   ÿÿ
þr#   ).)r
   r   r   r   r   r   )r
   r	   r   r   r   r   )r
   r   r   r   r   r   )NN)r   r   r   r   r   r   r   r	   )Ú
__future__r   Útypingr   r   r   r   r   r   r	   ÚtypeÚtupler   r   ÚstrÚbytesr#   r   r   r   r   Ú<module>   s     ý