5
5
import warnings
6
6
import yaml
7
7
8
+ from ._griffe_compat import GriffeLoader , ModulesCollection , LinesCollection
9
+ from ._griffe_compat import dataclasses as dc
10
+ from ._griffe_compat import Parser , parse
11
+
8
12
from fnmatch import fnmatchcase
9
- from griffe .loader import GriffeLoader
10
- from griffe .collections import ModulesCollection , LinesCollection
11
- from griffe .dataclasses import Alias
12
- from griffe .docstrings .parsers import Parser , parse
13
- from griffe .docstrings import dataclasses as ds # noqa
14
- from griffe import dataclasses as dc
15
13
from plum import dispatch # noqa
16
14
from pathlib import Path
17
15
from types import ModuleType
37
35
38
36
def parse_function (module : str , func_name : str ):
39
37
griffe = GriffeLoader ()
40
- mod = griffe .load_module (module )
38
+ mod = griffe .load (module )
41
39
42
40
f_data = mod .functions [func_name ]
43
41
@@ -66,7 +64,7 @@ def get_function(module: str, func_name: str, parser: str = "numpy") -> dc.Objec
66
64
griffe = GriffeLoader (
67
65
docstring_parser = Parser (parser ), docstring_options = get_parser_defaults (parser )
68
66
)
69
- mod = griffe .load_module (module )
67
+ mod = griffe .load (module )
70
68
71
69
f_data = mod .functions [func_name ]
72
70
@@ -138,7 +136,7 @@ def get_object(
138
136
# note that it is critical for performance that we only do this when necessary.
139
137
root_mod = module .split ("." , 1 )[0 ]
140
138
if root_mod not in loader .modules_collection :
141
- loader .load_module (module )
139
+ loader .load (module )
142
140
143
141
# griffe uses only periods for the path
144
142
griffe_path = f"{ module } .{ object_path } " if object_path else module
@@ -164,10 +162,10 @@ def get_object(
164
162
# Alias objects can refer to objects imported from other modules.
165
163
# in this case, we need to import the target's module in order to resolve
166
164
# the alias
167
- if isinstance (f_data , Alias ) and load_aliases :
165
+ if isinstance (f_data , dc . Alias ) and load_aliases :
168
166
target_mod = f_data .target_path .split ("." )[0 ]
169
167
if target_mod != module :
170
- loader .load_module (target_mod )
168
+ loader .load (target_mod )
171
169
172
170
return f_data
173
171
0 commit comments