|
19 | 19 | import logging
|
20 | 20 | import os
|
21 | 21 | import random
|
22 |
| -import sys |
23 | 22 |
|
24 | 23 | from ._config import config_context, get_config, set_config
|
25 | 24 |
|
|
59 | 58 | # https://github.com/ContinuumIO/anaconda-issues/issues/11294
|
60 | 59 | os.environ.setdefault("KMP_INIT_AT_FORK", "FALSE")
|
61 | 60 |
|
| 61 | +# `_distributor_init` allows distributors to run custom init code. |
| 62 | +# For instance, for the Windows wheel, this is used to pre-load the |
| 63 | +# vcomp shared library runtime for OpenMP embedded in the sklearn/.libs |
| 64 | +# sub-folder. |
| 65 | +# It is necessary to do this prior to importing show_versions as the |
| 66 | +# later is linked to the OpenMP runtime to make it possible to introspect |
| 67 | +# it and importing it first would fail if the OpenMP dll cannot be found. |
| 68 | +from . import ( # noqa: F401 E402 |
| 69 | + __check_build, |
| 70 | + _distributor_init, |
| 71 | +) |
| 72 | +from .base import clone # noqa: E402 |
| 73 | +from .utils._show_versions import show_versions # noqa: E402 |
| 74 | + |
| 75 | +__all__ = [ |
| 76 | + "calibration", |
| 77 | + "cluster", |
| 78 | + "covariance", |
| 79 | + "cross_decomposition", |
| 80 | + "datasets", |
| 81 | + "decomposition", |
| 82 | + "dummy", |
| 83 | + "ensemble", |
| 84 | + "exceptions", |
| 85 | + "experimental", |
| 86 | + "externals", |
| 87 | + "feature_extraction", |
| 88 | + "feature_selection", |
| 89 | + "gaussian_process", |
| 90 | + "inspection", |
| 91 | + "isotonic", |
| 92 | + "kernel_approximation", |
| 93 | + "kernel_ridge", |
| 94 | + "linear_model", |
| 95 | + "manifold", |
| 96 | + "metrics", |
| 97 | + "mixture", |
| 98 | + "model_selection", |
| 99 | + "multiclass", |
| 100 | + "multioutput", |
| 101 | + "naive_bayes", |
| 102 | + "neighbors", |
| 103 | + "neural_network", |
| 104 | + "pipeline", |
| 105 | + "preprocessing", |
| 106 | + "random_projection", |
| 107 | + "semi_supervised", |
| 108 | + "svm", |
| 109 | + "tree", |
| 110 | + "discriminant_analysis", |
| 111 | + "impute", |
| 112 | + "compose", |
| 113 | + # Non-modules: |
| 114 | + "clone", |
| 115 | + "get_config", |
| 116 | + "set_config", |
| 117 | + "config_context", |
| 118 | + "show_versions", |
| 119 | +] |
| 120 | + |
| 121 | +_BUILT_WITH_MESON = False |
62 | 122 | try:
|
63 |
| - # This variable is injected in the __builtins__ by the build |
64 |
| - # process. It is used to enable importing subpackages of sklearn when |
65 |
| - # the binaries are not built |
66 |
| - # mypy error: Cannot determine type of '__SKLEARN_SETUP__' |
67 |
| - __SKLEARN_SETUP__ # type: ignore |
68 |
| -except NameError: |
69 |
| - __SKLEARN_SETUP__ = False |
70 |
| - |
71 |
| -if __SKLEARN_SETUP__: |
72 |
| - sys.stderr.write("Partial import of sklearn during the build process.\n") |
73 |
| - # We are not importing the rest of scikit-learn during the build |
74 |
| - # process, as it may not be compiled yet |
75 |
| -else: |
76 |
| - # `_distributor_init` allows distributors to run custom init code. |
77 |
| - # For instance, for the Windows wheel, this is used to pre-load the |
78 |
| - # vcomp shared library runtime for OpenMP embedded in the sklearn/.libs |
79 |
| - # sub-folder. |
80 |
| - # It is necessary to do this prior to importing show_versions as the |
81 |
| - # later is linked to the OpenMP runtime to make it possible to introspect |
82 |
| - # it and importing it first would fail if the OpenMP dll cannot be found. |
83 |
| - from . import ( |
84 |
| - __check_build, # noqa: F401 |
85 |
| - _distributor_init, # noqa: F401 |
86 |
| - ) |
87 |
| - from .base import clone |
88 |
| - from .utils._show_versions import show_versions |
89 |
| - |
90 |
| - __all__ = [ |
91 |
| - "calibration", |
92 |
| - "cluster", |
93 |
| - "covariance", |
94 |
| - "cross_decomposition", |
95 |
| - "datasets", |
96 |
| - "decomposition", |
97 |
| - "dummy", |
98 |
| - "ensemble", |
99 |
| - "exceptions", |
100 |
| - "experimental", |
101 |
| - "externals", |
102 |
| - "feature_extraction", |
103 |
| - "feature_selection", |
104 |
| - "gaussian_process", |
105 |
| - "inspection", |
106 |
| - "isotonic", |
107 |
| - "kernel_approximation", |
108 |
| - "kernel_ridge", |
109 |
| - "linear_model", |
110 |
| - "manifold", |
111 |
| - "metrics", |
112 |
| - "mixture", |
113 |
| - "model_selection", |
114 |
| - "multiclass", |
115 |
| - "multioutput", |
116 |
| - "naive_bayes", |
117 |
| - "neighbors", |
118 |
| - "neural_network", |
119 |
| - "pipeline", |
120 |
| - "preprocessing", |
121 |
| - "random_projection", |
122 |
| - "semi_supervised", |
123 |
| - "svm", |
124 |
| - "tree", |
125 |
| - "discriminant_analysis", |
126 |
| - "impute", |
127 |
| - "compose", |
128 |
| - # Non-modules: |
129 |
| - "clone", |
130 |
| - "get_config", |
131 |
| - "set_config", |
132 |
| - "config_context", |
133 |
| - "show_versions", |
134 |
| - ] |
135 |
| - |
136 |
| - _BUILT_WITH_MESON = False |
137 |
| - try: |
138 |
| - import sklearn._built_with_meson # noqa: F401 |
139 |
| - |
140 |
| - _BUILT_WITH_MESON = True |
141 |
| - except ModuleNotFoundError: |
142 |
| - pass |
| 123 | + import sklearn._built_with_meson # noqa: F401 |
| 124 | + |
| 125 | + _BUILT_WITH_MESON = True |
| 126 | +except ModuleNotFoundError: |
| 127 | + pass |
143 | 128 |
|
144 | 129 |
|
145 | 130 | def setup_module(module):
|
|
0 commit comments