Skip to content

Commit 3bdf9c3

Browse files
committed
Fixed gpu_stump docstring when no GPU available
1 parent f326eb2 commit 3bdf9c3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

stumpy/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@
2626
from .gpu_stump import gpu_stump # noqa: F401
2727
else: # pragma: no cover
2828
from .core import driver_not_found as gpu_stump # noqa: F401
29+
import ast
30+
import pathlib
31+
32+
gpu_stump.__doc__ = ""
33+
filepath = pathlib.Path(__file__).parent / "gpu_stump.py"
34+
35+
file_contents = ""
36+
with open(filepath) as f:
37+
file_contents = f.read()
38+
module = ast.parse(file_contents)
39+
function_definitions = [
40+
node for node in module.body if isinstance(node, ast.FunctionDef)
41+
]
42+
for f in function_definitions:
43+
if f.name == "gpu_stump":
44+
gpu_stump.__doc__ = ast.get_docstring(f)
2945

3046
try:
3147
_dist = get_distribution("stumpy")

0 commit comments

Comments
 (0)