colour.utilities.common Module

Common Utilities

Defines common utilities objects that don”t fall in any specific category.

colour.utilities.common.batch(iterable, k=3)[source]

Returns a batch generator from given iterable.

Parameters:
  • iterable (iterable) – Iterable to create batches from.
  • k (integer) – Batches size.
Returns:

Is string_like variable.

Return type:

bool

Examples

>>> batch(tuple(range(10)))  
<generator object batch at 0x...>
colour.utilities.common.is_scipy_installed(raise_exception=False)[source]

Returns if scipy is installed and available.

Parameters:raise_exception (bool) – Raise exception if scipy is unavailable.
Returns:Is scipy installed.
Return type:bool
Raises:ImportError – If scipy is not installed.
colour.utilities.common.is_string(data)[source]

Returns if given data is a string_like variable.

Parameters:data (object) – Data to test.
Returns:Is string_like variable.
Return type:bool

Examples

>>> is_string('I`m a string!')
True
>>> is_string(['I`m a string!'])
False