(overwrite=False)
| 68 | |
| 69 | |
| 70 | def check_scheduler_doc(overwrite=False): |
| 71 | with open(PATH_TO_TOC, encoding="utf-8") as f: |
| 72 | content = yaml.safe_load(f.read()) |
| 73 | |
| 74 | # Get to the API doc |
| 75 | api_idx = 0 |
| 76 | while content[api_idx]["title"] != "API": |
| 77 | api_idx += 1 |
| 78 | api_doc = content[api_idx]["sections"] |
| 79 | |
| 80 | # Then to the model doc |
| 81 | scheduler_idx = 0 |
| 82 | while api_doc[scheduler_idx]["title"] != "Schedulers": |
| 83 | scheduler_idx += 1 |
| 84 | |
| 85 | scheduler_doc = api_doc[scheduler_idx]["sections"] |
| 86 | new_scheduler_doc = clean_doc_toc(scheduler_doc) |
| 87 | |
| 88 | diff = False |
| 89 | if new_scheduler_doc != scheduler_doc: |
| 90 | diff = True |
| 91 | if overwrite: |
| 92 | api_doc[scheduler_idx]["sections"] = new_scheduler_doc |
| 93 | |
| 94 | if diff: |
| 95 | if overwrite: |
| 96 | content[api_idx]["sections"] = api_doc |
| 97 | with open(PATH_TO_TOC, "w", encoding="utf-8") as f: |
| 98 | f.write(yaml.dump(content, allow_unicode=True)) |
| 99 | else: |
| 100 | raise ValueError( |
| 101 | "The model doc part of the table of content is not properly sorted, run `make style` to fix this." |
| 102 | ) |
| 103 | |
| 104 | |
| 105 | def check_pipeline_doc(overwrite=False): |
no test coverage detected