# 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)
    if estimator is not None:
        if isinstance(estimator, six.string_types):
            estimator_name = estimator.lower()
        else:
            estimator_name = estimator.__class__.__name__.lower()

        estimator_name = "[%s] " % estimator_name
    else:
        estimator_name = ""

    return estimator_name


def check_ensemble_build(inst, attr='stack'):
    """Check that layers have been instantiated."""
    if not hasattr(inst, attr):
        # No layer container. This should not happen!

        msg = ("No layer class attached to instance (%s). (Cannot find a "
               "'Sequential' class instance as attribute [%s].)")

        raise AttributeError(msg % (inst.__class__.__name__, attr))

    if getattr(inst, attr) is None:
        # No layers instantiated.

        if not getattr(inst, 'raise_on_exception', True):

            msg = "No Layers in instance (%s). Nothing to fit / predict."
            warnings.warn(msg % inst.__class__.__name__,

# 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)

    if estimator is not None:
        if isinstance(estimator, six.string_types):
            estimator_name = estimator.lower()
        else:
            estimator_name = estimator.__class__.__name__.lower()

        estimator_name = "[%s] " % estimator_name
    else:
        estimator_name = ""

    return estimator_name


def check_ensemble_build(inst, attr='stack'):
    """Check that layers have been instantiated."""
    if not hasattr(inst, attr):
        # No layer container. This should not happen!

        msg = ("No layer class attached to instance (%s). (Cannot find a "
               "'Sequential' class instance as attribute [%s].)")

        raise AttributeError(msg % (inst.__class__.__name__, attr))

    if getattr(inst, attr) is None:
        # No layers instantiated.

        if not getattr(inst, 'raise_on_exception', True):

            msg = "No Layers in instance (%s). Nothing to fit / predict."
            warnings.warn(msg % inst.__class__.__name__,

                          LayerSpecificationWarning)