|
6 | 6 | from functools import wraps
|
7 | 7 | from griffe.docstrings import dataclasses as ds
|
8 | 8 | from griffe import dataclasses as dc
|
| 9 | +from griffe import expressions as expr |
9 | 10 | from tabulate import tabulate
|
10 | 11 | from plum import dispatch
|
11 | 12 | from typing import Tuple, Union, Optional
|
|
14 | 15 | from .base import Renderer, escape, sanitize, convert_rst_link_to_md
|
15 | 16 |
|
16 | 17 |
|
17 |
| -try: |
18 |
| - # Name and Expression were moved to expressions in v0.28 |
19 |
| - from griffe import expressions as expr |
20 |
| -except ImportError: |
21 |
| - from griffe import dataclasses as expr |
22 |
| - |
23 |
| - |
24 | 18 | def _has_attr_section(el: dc.Docstring | None):
|
25 | 19 | if el is None:
|
26 | 20 | return False
|
@@ -130,16 +124,16 @@ def render_annotation(self, el: None) -> str:
|
130 | 124 | return ""
|
131 | 125 |
|
132 | 126 | @dispatch
|
133 |
| - def render_annotation(self, el: expr.Name) -> str: |
| 127 | + def render_annotation(self, el: expr.ExprName) -> str: |
134 | 128 | # TODO: maybe there is a way to get tabulate to handle this?
|
135 | 129 | # unescaped pipes screw up table formatting
|
136 | 130 | if self.render_interlinks:
|
137 |
| - return f"[{sanitize(el.source)}](`{el.full}`)" |
| 131 | + return f"[{sanitize(el.name)}](`{el.canonical_path}`)" |
138 | 132 |
|
139 |
| - return sanitize(el.source) |
| 133 | + return sanitize(el.canonical_path) |
140 | 134 |
|
141 | 135 | @dispatch
|
142 |
| - def render_annotation(self, el: expr.Expression) -> str: |
| 136 | + def render_annotation(self, el: expr.Expr) -> str: |
143 | 137 | return "".join(map(self.render_annotation, el))
|
144 | 138 |
|
145 | 139 | # signature method --------------------------------------------------------
|
|
0 commit comments