discretize.utils.requires

discretize.utils.requires(modules)[source]

Decorator to wrap functions with soft dependencies.

This function was inspired by the requires function of pysal, which is released under the ‘BSD 3-Clause “New” or “Revised” License’.

https://github.com/pysal/pysal/blob/master/pysal/lib/common.py

Parameters
modulesdict

Dictionary containing soft dependencies, e.g., {‘matplotlib’: matplotlib}.

Returns
decorated_functionfunction

Original function if all soft dependencies are met, otherwise it returns an empty function which prints why it is not running.