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

Function check_model_table

diffusers/utils/check_table.py:161–177  ·  view source on GitHub ↗

Check the model table in the index.rst is consistent with the state of the lib and maybe `overwrite`.

(overwrite=False)

Source from the content-addressed store, hash-verified

159
160
161def check_model_table(overwrite=False):
162 """Check the model table in the index.rst is consistent with the state of the lib and maybe `overwrite`."""
163 current_table, start_index, end_index, lines = _find_text_in_file(
164 filename=os.path.join(PATH_TO_DOCS, "index.md"),
165 start_prompt="<!--This table is updated automatically from the auto modules",
166 end_prompt="<!-- End table-->",
167 )
168 new_table = get_model_table_from_auto_modules()
169
170 if current_table != new_table:
171 if overwrite:
172 with open(os.path.join(PATH_TO_DOCS, "index.md"), "w", encoding="utf-8", newline="\n") as f:
173 f.writelines(lines[:start_index] + [new_table] + lines[end_index:])
174 else:
175 raise ValueError(
176 "The model table in the `index.md` has not been updated. Run `make fix-copies` to fix this."
177 )
178
179
180if __name__ == "__main__":

Callers 1

check_table.pyFile · 0.85

Calls 2

_find_text_in_fileFunction · 0.85

Tested by

no test coverage detected