We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b7b82c3 commit b9d8037Copy full SHA for b9d8037
src/runtime_docstrings/_parser.py
@@ -14,20 +14,25 @@
14
def _parse_docstrings(node: ast.ClassDef) -> dict[str, str]:
15
docs: dict[str, str] = {}
16
body = node.body
17
- for index in range(len(body) - 1):
18
- match body[index]:
+ end = len(body) - 1
+ index = 0
19
+ while index < end:
20
+ stmt = body[index]
21
+ index += 1
22
+ match stmt:
23
case ast.AnnAssign(target=ast.Name(id=name)):
24
pass
25
case ast.Assign(targets=[ast.Name(id=name)]):
26
27
case _:
28
continue
29
- match body[index + 1]:
30
+ match body[index]:
31
case ast.Expr(value=ast.Constant(value=doc_str)) if isinstance(
32
doc_str, str
33
):
34
docs[name] = inspect.cleandoc(doc_str)
35
36
return docs
37
38
0 commit comments