aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/utils.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/utils.py b/docs/utils.py
index 5be5292b..a4662ba4 100644
--- a/docs/utils.py
+++ b/docs/utils.py
@@ -99,6 +99,7 @@ def linkcode_resolve(repo_link: str, domain: str, info: dict[str, str]) -> typin
class NodeWithBody(typing.Protocol):
"""An AST node with the body attribute."""
+
body: list[ast.AST]
@@ -113,9 +114,10 @@ def _global_assign_pos(ast_: NodeWithBody, name: str) -> typing.Union[tuple[int,
names = []
for target in ast_obj.targets:
if isinstance(target, ast.Tuple):
- names.extend([name.id for name in target.elts])
+ names.extend([name.id for name in target.elts if isinstance(name, ast.Name)])
else:
- names.append(target.id)
+ if isinstance(target, ast.Name):
+ names.append(target.id)
if name in names:
return ast_obj.lineno, ast_obj.end_lineno