forked from TDAmeritrade/stumpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
197 lines (175 loc) · 7.5 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
import os.path
from importlib.metadata import distribution
from site import getsitepackages
from numba import cuda
from .aamp import aamp # noqa: F401
from .aamp_mmotifs import aamp_mmotifs # noqa: F401
from .aamp_motifs import aamp_match, aamp_motifs # noqa: F401
from .aamp_ostinato import aamp_ostinato, aamp_ostinatoed # noqa: F401
from .aamp_stimp import aamp_stimp, aamp_stimped # noqa: F401
from .aampdist import aampdist, aampdisted # noqa: F401
from .aampdist_snippets import aampdist_snippets # noqa: F401
from .aamped import aamped # noqa: F401
from .aampi import aampi # noqa: F401
from .chains import allc, atsc # noqa: F401
from .core import mass # noqa: F401
from .floss import floss, fluss # noqa: F401
from .maamp import maamp, maamp_mdl, maamp_subspace # noqa: F401
from .maamped import maamped # noqa: F401
from .mmotifs import mmotifs # noqa: F401
from .motifs import match, motifs # noqa: F401
from .mpdist import mpdist, mpdisted # noqa: F401
from .mstump import mdl, mstump, subspace # noqa: F401
from .mstumped import mstumped # noqa: F401
from .ostinato import ostinato, ostinatoed # noqa: F401
from .scraamp import prescraamp, scraamp # noqa: F401
from .scrump import prescrump, scrump # noqa: F401
from .snippets import snippets # noqa: F401
from .stimp import stimp, stimped # noqa: F401
from .stump import stump # noqa: F401
from .stumped import stumped # noqa: F401
from .stumpi import stumpi # noqa: F401
if cuda.is_available():
from .gpu_aamp import gpu_aamp # noqa: F401
from .gpu_aamp_ostinato import gpu_aamp_ostinato # noqa: F401
from .gpu_aamp_stimp import gpu_aamp_stimp # noqa: F401
from .gpu_aampdist import gpu_aampdist # noqa: F401
from .gpu_mpdist import gpu_mpdist # noqa: F401
from .gpu_ostinato import gpu_ostinato # noqa: F401
from .gpu_stimp import gpu_stimp # noqa: F401
from .gpu_stump import gpu_stump # noqa: F401
else: # pragma: no cover
from . import core
from .core import _gpu_aamp_driver_not_found as gpu_aamp # noqa: F401
from .core import ( # noqa: F401
_gpu_aamp_ostinato_driver_not_found as gpu_aamp_ostinato,
)
from .core import _gpu_aamp_stimp_driver_not_found as gpu_aamp_stimp # noqa: F401
from .core import _gpu_aampdist_driver_not_found as gpu_aampdist # noqa: F401
from .core import _gpu_mpdist_driver_not_found as gpu_mpdist # noqa: F401
from .core import _gpu_ostinato_driver_not_found as gpu_ostinato # noqa: F401
from .core import _gpu_stimp_driver_not_found as gpu_stimp # noqa: F401
from .core import _gpu_stump_driver_not_found as gpu_stump # noqa: F401
core._gpu_searchsorted_left = core._gpu_searchsorted_left_driver_not_found
core._gpu_searchsorted_right = core._gpu_searchsorted_right_driver_not_found
import ast
import pathlib
# Fix GPU-STUMP Docs
gpu_stump.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_stump.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_stump":
gpu_stump.__doc__ = ast.get_docstring(fd)
# Fix GPU-AAMP Docs
gpu_aamp.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_aamp.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_aamp":
gpu_aamp.__doc__ = ast.get_docstring(fd)
# Fix GPU-OSTINATO Docs
gpu_ostinato.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_ostinato.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_ostinato":
gpu_ostinato.__doc__ = ast.get_docstring(fd)
# Fix GPU-AAMP-OSTINATO Docs
gpu_aamp_ostinato.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_aamp_ostinato.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_aamp_ostinato":
gpu_aamp_ostinato.__doc__ = ast.get_docstring(fd)
# Fix GPU-MPDIST Docs
gpu_mpdist.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_mpdist.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_mpdist":
gpu_mpdist.__doc__ = ast.get_docstring(fd)
# Fix GPU-AAMPDIST Docs
gpu_aampdist.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_aampdist.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
function_definitions = [
node for node in module.body if isinstance(node, ast.FunctionDef)
]
for fd in function_definitions:
if fd.name == "gpu_aampdist":
gpu_aampdist.__doc__ = ast.get_docstring(fd)
# Fix GPU-STIMP Docs
# Note that this is a special case for class definitions.
# See above for function definitions.
# Also, please update docs/api.rst
gpu_stimp.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_stimp.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
class_definitions = [node for node in module.body if isinstance(node, ast.ClassDef)]
for cd in class_definitions:
if cd.name == "gpu_stimp":
gpu_stimp.__doc__ = ast.get_docstring(cd)
# Fix GPU-AAMP-STIMP Docs
# Note that this is a special case for class definitions.
# See above for function definitions.
# Also, please update docs/api.rst
gpu_aamp_stimp.__doc__ = ""
filepath = pathlib.Path(__file__).parent / "gpu_aamp_stimp.py"
file_contents = ""
with open(filepath, encoding="utf8") as f:
file_contents = f.read()
module = ast.parse(file_contents)
class_definitions = [node for node in module.body if isinstance(node, ast.ClassDef)]
for cd in class_definitions:
if cd.name == "gpu_aamp_stimp":
gpu_aamp_stimp.__doc__ = ast.get_docstring(cd)
try:
# _dist = get_distribution("stumpy")
_dist = distribution("stumpy")
# Normalize case for Windows systems
dist_loc = os.path.normcase(getsitepackages()[0])
here = os.path.normcase(__file__)
if not here.startswith(os.path.join(dist_loc, "stumpy")):
# not installed, but there is another version that *is*
raise ModuleNotFoundError # pragma: no cover
except ModuleNotFoundError: # pragma: no cover
__version__ = "Please install this project with setup.py"
else: # pragma: no cover
__version__ = _dist.version