MCPcopy Create free account
hub / github.com/apple/coremltools / replace_toc

Function replace_toc

deps/protobuf/python/docs/generate_docs.py:171–180  ·  view source on GitHub ↗
(modules)

Source from the content-addressed store, hash-verified

169
170
171def replace_toc(modules):
172 toctree = [module.replace(".", "/") for module in modules]
173 with open(DOCS_DIR / "index.rst", "r") as index_file:
174 index_contents = index_file.read()
175 toc = TOC_TEMPLATE.format(
176 toctree="\n ".join(toctree)
177 )
178 index_contents = re.sub(TOC_REGEX, toc, index_contents)
179 with open(DOCS_DIR / "index.rst", "w") as index_file:
180 index_file.write(index_contents)
181
182
183def main():

Callers 1

mainFunction · 0.85

Calls 7

openFunction · 0.85
replaceMethod · 0.80
subMethod · 0.80
readMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected