MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _get_docstring

Function _get_docstring

graphify/extract.py:5769–5781  ·  view source on GitHub ↗
(body_node)

Source from the content-addressed store, hash-verified

5767 file_nid = _make_id(str(path))
5768
5769 def _get_docstring(body_node) -> tuple[str, int] | None:
5770 if not body_node:
5771 return None
5772 for child in body_node.children:
5773 if child.type == "expression_statement":
5774 for sub in child.children:
5775 if sub.type in ("string", "concatenated_string"):
5776 text = source[sub.start_byte:sub.end_byte].decode("utf-8", errors="replace")
5777 text = text.strip("\"'").strip('"""').strip("'''").strip()
5778 if len(text) > 20:
5779 return text, child.start_point[0] + 1
5780 break
5781 return None
5782
5783 def _add_rationale(text: str, line: int, parent_nid: str) -> None:
5784 label = text[:80].replace("\r\n", " ").replace("\r", " ").replace("\n", " ").strip()

Callers 2

walk_docstringsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected