Check all docstrings are in md
()
| 714 | |
| 715 | |
| 716 | def 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 | |
| 739 | def check_repo_quality(): |
no test coverage detected