Пример #1
0
def get_worker():
    try:
        import pytest
    except ImportError:
        raise ImportError('You need pytest to run the test suite!')

    # check that we have at least version 2.1.2
    if _version_too_old(pytest.__version__, (2,1,2)):
        raise ImportError('You need at least pytest version 2.1.2,'
                ' found %s!'%pytest.__version__)
    else:
        return pytest.cmdline.main
Пример #2
0
def get_worker(loc):
    try:
        # use py.test module interface if it's installed
        import py.test
        # check that we have at least version 2.1.2
        try:
            py.test.__version__
        except AttributeError:
            raise ImportError
        if _version_too_old(py.test.__version__, (2,1,2)):
            raise ImportError
        else:
            return py.test.cmdline.main
    except ImportError:
        # try to locate the script
        script = os.path.join(loc, SCRIPT)
        if os.path.exists(script):
            return lambda args: subtest(script, args)
        else:
            raise Exception('Could not find self-contained py.test script in'
                            '"%s"'%script)
Пример #3
0
except ImportError:
    import scikits.learn as sklearn
    _sklearn_prefix = 'scikits.learn'

import inspect
import re

import mdp

class ScikitsException(mdp.NodeException):
    """Base class for exceptions in nodes wrapping scikits algorithms."""
    pass

# import all submodules of sklearn (to work around lazy import)
from mdp.configuration import _version_too_old
if _version_too_old(sklearn.__version__, (0, 8)):
    scikits_modules = ['ann', 'cluster', 'covariance', 'feature_extraction',
                       'feature_selection', 'features', 'gaussian_process', 'glm',
                       'linear_model', 'preprocessing', 'svm',
                       'pca', 'lda', 'hmm', 'fastica', 'grid_search', 'mixture',
                       'naive_bayes', 'neighbors', 'qda']
elif _version_too_old(sklearn.__version__, (0, 9)):
    # package structure has been changed in 0.8
    scikits_modules = ['svm', 'linear_model', 'naive_bayes', 'neighbors',
                       'mixture', 'hmm', 'cluster', 'decomposition', 'lda',
                       'covariance', 'cross_val', 'grid_search',
                       'feature_selection.rfe', 'feature_extraction.image',
                       'feature_extraction.text', 'pipelines', 'pls',
                       'gaussian_process', 'qda']
elif _version_too_old(sklearn.__version__, (0, 11)):
    # from release 0.9 cross_val becomes cross_validation and hmm is deprecated
Пример #4
0
    _sklearn_prefix = 'scikits.learn'

import inspect
import re

import mdp


class ScikitsException(mdp.NodeException):
    """Base class for exceptions in nodes wrapping scikits algorithms."""
    pass


# import all submodules of sklearn (to work around lazy import)
from mdp.configuration import _version_too_old
if _version_too_old(sklearn.__version__, (0, 8)):
    scikits_modules = [
        'ann', 'cluster', 'covariance', 'feature_extraction',
        'feature_selection', 'features', 'gaussian_process', 'glm',
        'linear_model', 'preprocessing', 'svm', 'pca', 'lda', 'hmm', 'fastica',
        'grid_search', 'mixture', 'naive_bayes', 'neighbors', 'qda'
    ]
elif _version_too_old(sklearn.__version__, (0, 9)):
    # package structure has been changed in 0.8
    scikits_modules = [
        'svm', 'linear_model', 'naive_bayes', 'neighbors', 'mixture', 'hmm',
        'cluster', 'decomposition', 'lda', 'covariance', 'cross_val',
        'grid_search', 'feature_selection.rfe', 'feature_extraction.image',
        'feature_extraction.text', 'pipelines', 'pls', 'gaussian_process',
        'qda'
    ]