MCPcopy
hub / github.com/vinta/awesome-python / _extract_description_children

Function _extract_description_children

website/readme_parser.py:124–139  ·  view source on GitHub ↗

Extract description children from the first paragraph if it's a single block. Pattern: _Libraries for foo._ -> "Libraries for foo."

(nodes: list[SyntaxTreeNode])

Source from the content-addressed store, hash-verified

122
123
124def _extract_description_children(nodes: list[SyntaxTreeNode]) -> list[SyntaxTreeNode]:
125 """Extract description children from the first paragraph if it&#x27;s a single <em> block.
126
127 Pattern: _Libraries for foo._ -> "Libraries for foo."
128 """
129 if not nodes:
130 return []
131 first = nodes[0]
132 if first.type != "paragraph":
133 return []
134 for child in first.children:
135 if child.type == "inline" and len(child.children) == 1:
136 em = child.children[0]
137 if em.type == "em":
138 return em.children
139 return []
140
141
142# --- Entry extraction --------------------------------------------------------

Callers 1

_build_sectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected