File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 22
33import argparse
44import importlib
5+ import pathlib
6+ import re
57
6- from stumpy .cache import get_njit_funcs
8+
9+ def get_njit_funcs ():
10+ """
11+ Retrieve a list of all njit functions
12+
13+ Parameters
14+ ----------
15+ None
16+
17+ Returns
18+ -------
19+ njit_funcs : list
20+ A list of all njit functions, where each element is a tuple of the form
21+ (module_name, func_name)
22+ """
23+ pattern = r"@njit.*?def\s+\w+\("
24+
25+ stumpy_path = pathlib .Path (__file__ ).parent / "stumpy"
26+ filepaths = sorted (f for f in pathlib .Path (stumpy_path ).iterdir () if f .is_file ())
27+
28+ out = []
29+ ignore = ["__init__.py" , "__pycache__" ]
30+ for filepath in filepaths :
31+ fname = filepath .name
32+ if fname not in ignore and fname .endswith (".py" ):
33+ file_contents = ""
34+ with open (filepath , encoding = "utf8" ) as f :
35+ file_contents = f .read ()
36+
37+ matches = re .findall (pattern , file_contents , re .DOTALL )
38+ for match in matches :
39+ func_name = match .split ("def " )[- 1 ].split ("(" )[0 ]
40+ out .append ((fname .removesuffix (".py" ), func_name ))
41+
42+ return out
743
844
945def check_fastmath ():
You can’t perform that action at this time.
0 commit comments