# Path: mlens/utils/exceptions.py
# class NotFittedError(ValueError, AttributeError):
# 
#     """Error class for an ensemble or estimator that is not fitted yet
# 
#     Raised when some method has been called that expects the instance to be
#     fitted.
#     """
# 
# class LayerSpecificationWarning(UserWarning):
# 
#     """Warning class if layer has been specified in a dubious form.
# 
#     This warning is raised when the input does not look like expected, but
#     is not fatal and a best guess of how to fix it will be made.
#     """
# 
# class LayerSpecificationError(TypeError, ValueError):
# 
#     """Error class for incorrectly specified layers."""
# 
# class ParallelProcessingError(AttributeError, RuntimeError):
# 
#     """Error class for fatal errors related to :class:`ParallelProcessing`.
# 
#     Can be subclassed for more specific error classes.
#     """
# 
# class ParallelProcessingWarning(UserWarning):
# 
#     """Warnings related to methods on :class:`ParallelProcessing`.
# 
#     Can be subclassed for more specific warning classes.
#     """


import warnings
from .exceptions import (NotFittedError, LayerSpecificationWarning,
                         LayerSpecificationError, ParallelProcessingError,
                         ParallelProcessingWarning)
                   "estimator cases:     %r\npreprocessing cases: %r")
            raise LayerSpecificationError(msg % (list(estimators),
                                                 list(preprocessing)))
        if not all(prep_check):
            msg = ("Too few preprocessing cases to match estimators cases:\n"
                   "preprocessing cases: %r\nestimator cases:     %r")
            raise LayerSpecificationError(msg % (list(preprocessing),
                                                 list(estimators)))


def check_initialized(inst):
    """Check if a ParallelProcessing instance is initialized properly."""
    if not inst.__initialized__:
        msg = "ParallelProcessing is not initialized. Call " \
              "'initialize' before calling 'fit'."
        raise ParallelProcessingError(msg)

    if getattr(inst, '__fitted__', None):
        if inst.layers.raise_on_exception:
            raise ParallelProcessingError("This instance is already "
                                          "fitted and its parallel "
                                          "processing jobs has not been "
                                          "terminated. To refit "
                                          "instance, call 'terminate' "
                                          "before calling 'fit'.")
        else:
            warnings.warn("This instance is already "
                          "fitted and its parallel "
                          "processing job has not been "
                          "terminated. Will refit using previous job's cache.",

# Path: mlens/utils/exceptions.py
# class NotFittedError(ValueError, AttributeError):
# 
#     """Error class for an ensemble or estimator that is not fitted yet
# 
#     Raised when some method has been called that expects the instance to be
#     fitted.
#     """
# 
# class LayerSpecificationWarning(UserWarning):
# 
#     """Warning class if layer has been specified in a dubious form.
# 
#     This warning is raised when the input does not look like expected, but
#     is not fatal and a best guess of how to fix it will be made.
#     """
# 
# class LayerSpecificationError(TypeError, ValueError):
# 
#     """Error class for incorrectly specified layers."""
# 
# class ParallelProcessingError(AttributeError, RuntimeError):
# 
#     """Error class for fatal errors related to :class:`ParallelProcessing`.
# 
#     Can be subclassed for more specific error classes.
#     """
# 
# class ParallelProcessingWarning(UserWarning):
# 
#     """Warnings related to methods on :class:`ParallelProcessing`.
# 
#     Can be subclassed for more specific warning classes.
#     """


# Path: mlens/utils/checks.py
import warnings
from .exceptions import (NotFittedError, LayerSpecificationWarning,
                         LayerSpecificationError, ParallelProcessingError,
                         ParallelProcessingWarning)

                   "estimator cases:     %r\npreprocessing cases: %r")
            raise LayerSpecificationError(msg % (list(estimators),
                                                 list(preprocessing)))
        if not all(prep_check):
            msg = ("Too few preprocessing cases to match estimators cases:\n"
                   "preprocessing cases: %r\nestimator cases:     %r")
            raise LayerSpecificationError(msg % (list(preprocessing),
                                                 list(estimators)))


def check_initialized(inst):
    """Check if a ParallelProcessing instance is initialized properly."""
    if not inst.__initialized__:
        msg = "ParallelProcessing is not initialized. Call " \
              "'initialize' before calling 'fit'."
        raise ParallelProcessingError(msg)

    if getattr(inst, '__fitted__', None):
        if inst.layers.raise_on_exception:
            raise ParallelProcessingError("This instance is already "
                                          "fitted and its parallel "
                                          "processing jobs has not been "
                                          "terminated. To refit "
                                          "instance, call 'terminate' "
                                          "before calling 'fit'.")
        else:
            warnings.warn("This instance is already "
                          "fitted and its parallel "
                          "processing job has not been "
                          "terminated. Will refit using previous job's cache.",

                          ParallelProcessingWarning)