imgaug.validation

Helper functions to validate input data and produce error messages.

imgaug.validation.assert_is_iterable_of(iterable_var, classes)[source]

Assert that iterable_var only contains instances of given classes.

Parameters:
imgaug.validation.convert_iterable_to_string_of_types(iterable_var)[source]

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:String representation of the types in iterable_var. One per item in iterable_var. Separated by commas.
Return type:str
imgaug.validation.is_iterable_of(iterable_var, classes)[source]

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:

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

Return type:

bool