MCPcopy Create free account
hub / github.com/PaddlePaddle/Paddle / markdown_sections

Function markdown_sections

tools/commitlist.py:178–194  ·  view source on GitHub ↗
(body: str)

Source from the content-addressed store, hash-verified

176
177
178def markdown_sections(body: str) -> dict[str, str]:
179 cleaned = (
180 strip_html_comments(body).replace("\r\n", "\n").replace("\r", "\n")
181 )
182 matches = list(HEADING_RE.finditer(cleaned))
183 sections: dict[str, str] = {}
184 for index, match in enumerate(matches):
185 start = match.end()
186 end = (
187 matches[index + 1].start()
188 if index + 1 < len(matches)
189 else len(cleaned)
190 )
191 sections[normalize_whitespace(match.group(1))] = cleaned[
192 start:end
193 ].strip()
194 return sections
195
196
197def section_value(sections: dict[str, str], name: str) -> str:

Callers 3

resolve_categoryFunction · 0.85
resolve_topicFunction · 0.85
resolve_descriptionFunction · 0.85

Calls 7

strip_html_commentsFunction · 0.85
listFunction · 0.85
normalize_whitespaceFunction · 0.85
replaceMethod · 0.45
endMethod · 0.45
startMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected