# Path: mlens/config.py
# def get_ivals():
#     """Return _IVALS"""
#     return _IVALS
# 
# Path: mlens/utils/exceptions.py
# 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 os
import sys
import warnings
import subprocess
    import psutil
    import cPickle as pickle
    import pickle
from numpy import array
from ..config import get_ivals
from .exceptions import ParallelProcessingError, ParallelProcessingWarning
from time import sleep
    from time import perf_counter as time
    from time import time
    """Filetype enforcer"""
    if not name.endswith('.pkl'):
        name = '.'.join([name, 'pkl'])
    return name


def pickle_save(obj, name):
    """Utility function for pickling an object"""
    with open(pickled(name), 'wb') as f:
        pickle.dump(obj, f)


def pickle_load(name):
    """Utility function for loading pickled object"""
    with open(pickled(name), 'rb') as f:
        return pickle.load(f)


def load(file, enforce_filetype=True):
    """Utility exception handler for loading file"""
    s, lim = get_ivals()
    if enforce_filetype:
        file = pickled(file)
    try:
        return pickle_load(file)
    except (EOFError, OSError, IOError) as exc:
        msg = str(exc)
        warnings.warn(
            "Could not load transformer at %s. Will check every %.1f seconds "
            "for %i seconds before aborting. " % (file, s, lim),

# Path: mlens/config.py
# def get_ivals():
#     """Return _IVALS"""
#     return _IVALS
# 
# Path: mlens/utils/exceptions.py
# 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/utils.py
import os
import sys
import warnings
import subprocess
    import psutil
    import cPickle as pickle
    import pickle
from numpy import array
from ..config import get_ivals
from .exceptions import ParallelProcessingError, ParallelProcessingWarning
from time import sleep
    from time import perf_counter as time
    from time import time

    """Filetype enforcer"""
    if not name.endswith('.pkl'):
        name = '.'.join([name, 'pkl'])
    return name


def pickle_save(obj, name):
    """Utility function for pickling an object"""
    with open(pickled(name), 'wb') as f:
        pickle.dump(obj, f)


def pickle_load(name):
    """Utility function for loading pickled object"""
    with open(pickled(name), 'rb') as f:
        return pickle.load(f)


def load(file, enforce_filetype=True):
    """Utility exception handler for loading file"""
    s, lim = get_ivals()
    if enforce_filetype:
        file = pickled(file)
    try:
        return pickle_load(file)
    except (EOFError, OSError, IOError) as exc:
        msg = str(exc)
        warnings.warn(
            "Could not load transformer at %s. Will check every %.1f seconds "
            "for %i seconds before aborting. " % (file, s, lim),

            ParallelProcessingWarning)