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

Function _replace

diffusers/utils/custom_init_isort.py:189–198  ·  view source on GitHub ↗
(match)

Source from the content-addressed store, hash-verified

187
188 # This inner function sort imports between [ ].
189 def _replace(match):
190 imports = match.groups()[0]
191 # If there is one import only, nothing to do.
192 if "," not in imports:
193 return f"[{imports}]"
194 keys = [part.strip().replace('"', "") for part in imports.split(",")]
195 # We will have a final empty element if the line finished with a comma.
196 if len(keys[-1]) == 0:
197 keys = keys[:-1]
198 return "[" + ", ".join([f'"{k}"' for k in sort_objects(keys)]) + "]"
199
200 lines = import_statement.split("\n")
201 if len(lines) > 3:

Callers

nothing calls this directly

Calls 1

sort_objectsFunction · 0.85

Tested by

no test coverage detected