Skip to content

Commit 978101b

Browse files
Update scripts/check_docstrings_coverage.py
Co-authored-by: Copilot <[email protected]>
1 parent 7475d46 commit 978101b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

scripts/check_docstrings_coverage.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,12 @@ def get_docstring(node: ast.AST) -> Optional[str]:
9696
return None
9797
first_node = node.body[0]
9898
if isinstance(first_node, ast.Expr) and isinstance(first_node.value, ast.Str):
99-
return first_node.value.s
99+
if isinstance(first_node, ast.Expr):
100+
if (
101+
isinstance(first_node.value, ast.Str)
102+
or (isinstance(first_node.value, ast.Constant) and isinstance(first_node.value.value, str))
103+
):
104+
return first_node.value.s if hasattr(first_node.value, "s") else first_node.value.value
100105
return None
101106
except (AttributeError, IndexError):
102107
return None

0 commit comments

Comments
 (0)