File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ jupyter : python3
3
+ ---
4
+
5
+ ``` {python}
6
+ from griffe.loader import GriffeLoader
7
+ from griffe.docstrings.parsers import Parser
8
+
9
+ griffe = GriffeLoader(docstring_parser = Parser("numpy"))
10
+ mod = griffe.load_module("vetiver") # no editable install
11
+
12
+ #f_obj = mod._modules_collection["vetiver.load_pkgs"]
13
+ ```
14
+
15
+ ``` {python}
16
+ mod._modules_collection["vetiver.attach_pkgs.load_pkgs"] # full path
17
+ ```
18
+
19
+ ``` {python}
20
+ from quartodoc import get_function, MdRenderer
21
+
22
+ # get function object ---
23
+ f_obj = get_function("vetiver.attach_pkgs", "load_pkgs") # not attach.laod
24
+
25
+
26
+ # render ---
27
+ renderer = MdRenderer(header_level = 1)
28
+ print(
29
+ renderer.to_md(f_obj)
30
+ )
31
+ ```
32
+
33
+ ``` {python}
34
+ c_obj = mod._modules_collection["vetiver.server.VetiverAPI"]
35
+
36
+ print(
37
+ renderer.to_md(c_obj)
38
+ )
39
+ ```
40
+
41
+ ``` {python}
42
+ renderer.to_md(c_obj.members["vetiver_post"]) # no -> none
43
+ ```
44
+
45
+
Original file line number Diff line number Diff line change @@ -180,7 +180,10 @@ def to_md(self, el: ds.DocstringSectionParameters):
180
180
def to_md (self , el : ds .DocstringParameter ) -> Tuple [str ]:
181
181
# TODO: if default is not, should return the word "required" (unescaped)
182
182
default = "required" if el .default is None else escape (el .default )
183
- annotation = el .annotation .full if el .annotation else None
183
+ if isinstance (el .annotation , str ):
184
+ annotation = el .annotation
185
+ else :
186
+ annotation = el .annotation .full if el .annotation else None
184
187
return (escape (el .name ), annotation , el .description , default )
185
188
186
189
# examples ----
You can’t perform that action at this time.
0 commit comments