milia.core.exceptions#
Milia exception hierarchy and the optional-dependency guard.
Functions
|
Raise a helpful error if an optional dependency is missing. |
Exceptions
Raised when a configuration is invalid or incompatible. |
|
Base class for all milia exceptions. |
|
Raised when an optional dependency is not installed. |
|
Raised when an estimator is used before it is fitted. |
- exception milia.core.exceptions.ConfigurationError#
Bases:
MiliaError,ValueErrorRaised when a configuration is invalid or incompatible.
Examples
>>> from milia import get >>> get("detector", "nope") Traceback (most recent call last): ... milia.core.exceptions.ConfigurationError: no detector named 'nope'; ...
- exception milia.core.exceptions.MissingExtraError#
Bases:
MiliaError,ImportErrorRaised when an optional dependency is not installed.
Examples
>>> require("definitely_not_a_package", "foo") Traceback (most recent call last): ... milia.core.exceptions.MissingExtraError: 'definitely_not_a_package' is required ...
- exception milia.core.exceptions.NotFittedError#
Bases:
MiliaError,NotFittedErrorRaised when an estimator is used before it is fitted.
Subclasses scikit-learn’s own
NotFittedError, so code that catches the scikit-learn exception also catches this one.Examples
>>> from sklearn.exceptions import NotFittedError as Sklearn >>> issubclass(NotFittedError, Sklearn) True
- exception milia.core.exceptions.MiliaError#
Bases:
ExceptionBase class for all milia exceptions.
Examples
>>> issubclass(ConfigurationError, MiliaError) True
- milia.core.exceptions.require(package, extra)#
Raise a helpful error if an optional dependency is missing.
Called at the top of every module that needs an optional package, before the package itself is imported, so the user is told which extra to install.
- Parameters:
- Raises:
MissingExtraError – If
packagecannot be imported.- Return type:
Examples
>>> require("numpy", "core")