MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / check_docstrings_are_in_md

Function check_docstrings_are_in_md

diffusers/utils/check_repo.py:716–736  ·  view source on GitHub ↗

Check all docstrings are in md

()

Source from the content-addressed store, hash-verified

714
715
716def check_docstrings_are_in_md():
717 """Check all docstrings are in md"""
718 files_with_rst = []
719 for file in Path(PATH_TO_DIFFUSERS).glob("**/*.py"):
720 with open(file, "r") as f:
721 code = f.read()
722 docstrings = code.split('"""')
723
724 for idx, docstring in enumerate(docstrings):
725 if idx % 2 == 0 or not is_rst_docstring(docstring):
726 continue
727 files_with_rst.append(file)
728 break
729
730 if len(files_with_rst) > 0:
731 raise ValueError(
732 "The following files have docstrings written in rst:\n"
733 + "\n".join([f"- {f}" for f in files_with_rst])
734 + "\nTo fix this run `doc-builder convert path_to_py_file` after installing `doc-builder`\n"
735 "(`pip install git+https://github.com/huggingface/doc-builder`)"
736 )
737
738
739def check_repo_quality():

Callers 1

Calls 1

is_rst_docstringFunction · 0.85

Tested by

no test coverage detected