colour.utilities.multiprocessing_pool

colour.utilities.multiprocessing_pool(*args: Any, **kwargs: Any) Generator[source]

Define a context manager providing a multiprocessing pool.

Parameters
  • args (Any) – Arguments.

  • kwargs (Any) – Keywords arguments.

Yields

Generator – Multiprocessing pool.

Return type

Generator

Examples

>>> from functools import partial
>>> def _add(a, b):
...     return a + b
>>> with multiprocessing_pool() as pool:
...     pool.map(partial(_add, b=2), range(10))
... 
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11]