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

Function check_all_inits

diffusers/utils/check_inits.py:222–238  ·  view source on GitHub ↗

Check all inits in the transformers repo and raise an error if at least one does not define the same objects in both halves.

()

Source from the content-addressed store, hash-verified

220
221
222def check_all_inits():
223 """
224 Check all inits in the transformers repo and raise an error if at least one does not define the same objects in
225 both halves.
226 """
227 failures = []
228 for root, _, files in os.walk(PATH_TO_TRANSFORMERS):
229 if "__init__.py" in files:
230 fname = os.path.join(root, "__init__.py")
231 objects = parse_init(fname)
232 if objects is not None:
233 errors = analyze_results(*objects)
234 if len(errors) > 0:
235 errors[0] = f"Problem in {fname}, both halves do not define the same objects.\n{errors[0]}"
236 failures.append("\n".join(errors))
237 if len(failures) > 0:
238 raise ValueError("\n\n".join(failures))
239
240
241def get_transformers_submodules():

Callers 1

check_inits.pyFile · 0.85

Calls 3

parse_initFunction · 0.85
analyze_resultsFunction · 0.85
walkMethod · 0.80

Tested by

no test coverage detected