|
25 | 25 |
|
26 | 26 |
|
27 | 27 | # Mock out stuff for readthedocs.org |
28 | | -on_rtd = os.environ.get('READTHEDOCS', None) == 'True' |
29 | | -if on_rtd: |
30 | | - |
31 | | - try: |
32 | | - from mock import Mock as MagicMock |
33 | | - except: |
34 | | - from unittest.mock import MagicMock |
35 | | - |
36 | | - class Mock(MagicMock): |
37 | | - @classmethod |
38 | | - def __getattr__(cls, name): |
39 | | - if 'BaseEstimator' in name: |
40 | | - class BaseEstimator(object): |
41 | | - pass |
42 | | - |
43 | | - return BaseEstimator |
44 | | - return Mock() |
45 | | - |
46 | | - MOCK_MODULES = ['lockfile', |
47 | | - 'joblib', |
48 | | - 'psutil', |
49 | | - 'pyyaml', |
50 | | - 'ConfigArgParse', |
51 | | - 'arff', |
52 | | - 'pandas', |
53 | | - 'Cython', |
54 | | - 'numpy', |
55 | | - 'scipy', 'scipy.sparse', 'scipy.stats', 'scipy.linalg', |
56 | | - 'sklearn', |
57 | | - 'sklearn.base', |
58 | | - 'sklearn.cross_validation', |
59 | | - 'sklearn.dummy', |
60 | | - 'sklearn.metrics', |
61 | | - 'sklearn.multiclass', |
62 | | - 'sklearn.neighbors', |
63 | | - 'sklearn.utils', |
64 | | - 'psutil','pyyaml','pandas', |
65 | | - 'matplotlib', |
66 | | - 'autosklearn.pipeline', |
67 | | - 'autosklearn.pipeline.implementations', |
68 | | - 'autosklearn.pipeline.implementations.OneHotEncoder', |
69 | | - 'autosklearn.pipeline.implementations.Imputation', |
70 | | - 'autosklearn.pipeline.implementations.StandardScaler', |
71 | | - 'autosklearn.pipeline.implementations.util' |
72 | | - 'autosklearn.pipeline.classification', |
73 | | - 'autosklearn.pipeline.regression', |
74 | | - 'HPOlibConfigSpace', |
75 | | - 'HPOlibConfigSpace.converters', |
76 | | - 'HPOlibConfigSpace.configuration_space'] |
77 | | - |
78 | | - sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) |
| 28 | +#on_rtd = os.environ.get('READTHEDOCS', None) == 'True' |
| 29 | +#if on_rtd: |
| 30 | + |
| 31 | +try: |
| 32 | + from mock import Mock as MagicMock |
| 33 | +except: |
| 34 | + from unittest.mock import MagicMock |
| 35 | + |
| 36 | +class Mock(MagicMock): |
| 37 | + @classmethod |
| 38 | + def __getattr__(cls, name): |
| 39 | + if 'BaseEstimator' in name: |
| 40 | + class BaseEstimator(object): |
| 41 | + pass |
| 42 | + |
| 43 | + return BaseEstimator |
| 44 | + return Mock() |
| 45 | + |
| 46 | +MOCK_MODULES = ['lockfile', |
| 47 | + 'joblib', |
| 48 | + 'psutil', |
| 49 | + 'pyyaml', |
| 50 | + 'ConfigArgParse', |
| 51 | + 'arff', |
| 52 | + 'pandas', |
| 53 | + 'Cython', |
| 54 | + 'numpy', 'numpy.random', |
| 55 | + 'scipy', 'scipy.sparse', 'scipy.stats', 'scipy.linalg', |
| 56 | + 'scipy.sparse.linalg', |
| 57 | + 'sklearn', |
| 58 | + 'sklearn.base', |
| 59 | + 'sklearn.cross_validation', |
| 60 | + 'sklearn.dummy', |
| 61 | + 'sklearn.metrics', |
| 62 | + 'sklearn.multiclass', |
| 63 | + 'sklearn.neighbors', |
| 64 | + 'sklearn.utils', |
| 65 | + 'psutil','pyyaml','pandas', |
| 66 | + 'matplotlib', |
| 67 | + 'autosklearn.cli.base_interface', |
| 68 | + 'autosklearn.pipeline.implementations.OneHotEncoder', |
| 69 | + 'autosklearn.pipeline.implementations.Imputation', |
| 70 | + 'autosklearn.pipeline.implementations.StandardScaler', |
| 71 | + 'autosklearn.pipeline.implementations.MultilabelClassifier', |
| 72 | + 'autosklearn.pipeline.classification', |
| 73 | + 'autosklearn.pipeline.regression', |
| 74 | + 'HPOlibConfigSpace', |
| 75 | + 'HPOlibConfigSpace.converters', |
| 76 | + 'HPOlibConfigSpace.configuration_space', |
| 77 | + 'HPOlibConfigSpace.hyperparameters', |
| 78 | + 'HPOlibConfigSpace.conditions', |
| 79 | + 'HPOlibConfigSpace.forbidden'] |
| 80 | + |
| 81 | +sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) |
79 | 82 |
|
80 | 83 | # Add the parent directory of this file to the PYTHONPATH |
81 | 84 | import os |
|
0 commit comments