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

Function get_transformers_submodules

diffusers/utils/check_inits.py:241–265  ·  view source on GitHub ↗

Returns the list of Transformers submodules.

()

Source from the content-addressed store, hash-verified

239
240
241def get_transformers_submodules():
242 """
243 Returns the list of Transformers submodules.
244 """
245 submodules = []
246 for path, directories, files in os.walk(PATH_TO_TRANSFORMERS):
247 for folder in directories:
248 # Ignore private modules
249 if folder.startswith("_"):
250 directories.remove(folder)
251 continue
252 # Ignore leftovers from branches (empty folders apart from pycache)
253 if len(list((Path(path) / folder).glob("*.py"))) == 0:
254 continue
255 short_path = str((Path(path) / folder).relative_to(PATH_TO_TRANSFORMERS))
256 submodule = short_path.replace(os.path.sep, ".")
257 submodules.append(submodule)
258 for fname in files:
259 if fname == "__init__.py":
260 continue
261 short_path = str((Path(path) / fname).relative_to(PATH_TO_TRANSFORMERS))
262 submodule = short_path.replace(".py", "").replace(os.path.sep, ".")
263 if len(submodule.split(".")) == 1:
264 submodules.append(submodule)
265 return submodules
266
267
268IGNORE_SUBMODULES = [

Callers 1

check_submodulesFunction · 0.85

Calls 1

walkMethod · 0.80

Tested by

no test coverage detected