o
    &ÕjÌ	  ã                   @   s(   d Z ddlZdd„ Zdd„ Zdd„ ZdS )	zCHelper functions to validate input data and produce error messages.é    Nc                 C   s   dd„ | D ƒ}d  |¡S )aQ  Convert an iterable of values to a string of their types.

    Parameters
    ----------
    iterable_var : iterable
        An iterable of variables, e.g. a list of integers.

    Returns
    -------
    str
        String representation of the types in `iterable_var`. One per item
        in `iterable_var`. Separated by commas.

    c                 S   s   g | ]}t t|ƒƒ‘qS © )ÚstrÚtype)Ú.0Úvar_ir   r   úR/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/imgaug/validation.pyÚ
<listcomp>   s    z7convert_iterable_to_string_of_types.<locals>.<listcomp>ú, )Újoin)Úiterable_varÚtypesr   r   r   Ú#convert_iterable_to_string_of_types   s   
r   c                 C   s,   t  | ¡sdS | D ]
}t||ƒs dS q	dS )a  Check whether `iterable_var` contains only instances of given classes.

    Parameters
    ----------
    iterable_var : iterable
        An iterable of items that will be matched against `classes`.

    classes : type or iterable of type
        One or more classes that each item in `var` must be an instanceof.
        If this is an iterable, a single match per item is enough.

    Returns
    -------
    bool
        Whether `var` only contains instances of `classes`.
        If `var` was empty, ``True`` will be returned.

    FT)ÚiaÚis_iterableÚ
isinstance)r   Úclassesr   r   r   r   Úis_iterable_of   s   

ÿr   c                 C   sj   t | |ƒ}|s3t|tƒsd dd„ |D ƒ¡n|j}t | ¡s)td|t| ƒjf ƒ‚td|t| ƒf ƒ‚dS )a  Assert that `iterable_var` only contains instances of given classes.

    Parameters
    ----------
    iterable_var : iterable
        See :func:`~imgaug.validation.is_iterable_of`.

    classes : type or iterable of type
        See :func:`~imgaug.validation.is_iterable_of`.

    r	   c                 S   s   g | ]}|j ‘qS r   )Ú__name__)r   Úclass_r   r   r   r   D   s    z)assert_is_iterable_of.<locals>.<listcomp>zVExpected an iterable of the following types: %s. Got instead a single instance of: %s.zNExpected an iterable of the following types: %s. Got an iterable of types: %s.N)	r   r   r   r
   r   r   r   ÚAssertionErrorr   )r   r   ÚvalidZexpected_types_strr   r   r   Úassert_is_iterable_of5   s,   
ÿý
þÿÿþÿÿór   )Ú__doc__Zimgaugr   r   r   r   r   r   r   r   Ú<module>   s
    