MCPcopy Create free account
hub / github.com/apache/arrow / _count_docstrings

Function _count_docstrings

ci/scripts/python_wheel_validate_contents.py:25–37  ·  view source on GitHub ↗

Count docstrings in module, function, and class bodies.

(source)

Source from the content-addressed store, hash-verified

23
24
25def _count_docstrings(source):
26 """Count docstrings in module, function, and class bodies."""
27 tree = ast.parse(source)
28 count = 0
29 for node in ast.walk(tree):
30 if isinstance(node, (ast.Module, ast.FunctionDef,
31 ast.AsyncFunctionDef, ast.ClassDef)):
32 if (node.body
33 and isinstance(node.body[0], ast.Expr)
34 and isinstance(node.body[0].value, ast.Constant)
35 and isinstance(node.body[0].value.value, str)):
36 count += 1
37 return count
38
39
40# TODO(GH-48970): Check stubs ARE present once annotations are complete

Callers 1

validate_wheelFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected