MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / find_valid_backends

Function find_valid_backends

ui/easydiffusion/backend_manager.py:26–45  ·  view source on GitHub ↗
(root_dir)

Source from the content-addressed store, hash-verified

24
25
26def find_valid_backends(root_dir) -> dict:
27 backends_path = os.path.join(root_dir, "backends")
28 valid_backends = {}
29
30 if not os.path.exists(backends_path):
31 return valid_backends
32
33 for item in os.listdir(backends_path):
34 item_path = os.path.join(backends_path, item)
35
36 if os.path.isdir(item_path):
37 init_file = os.path.join(item_path, "__init__.py")
38 if os.path.exists(init_file) and is_valid_backend(init_file):
39 valid_backends[item] = item_path
40 elif item.endswith(".py"):
41 if is_valid_backend(item_path):
42 backend_name = os.path.splitext(item)[0] # strip the .py extension
43 valid_backends[backend_name] = item_path
44
45 return valid_backends
46
47
48def load_backend_module(backend_name, backend_dict):

Callers 1

start_backendFunction · 0.85

Calls 1

is_valid_backendFunction · 0.85

Tested by

no test coverage detected