(root_dir)
| 24 | |
| 25 | |
| 26 | def 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 | |
| 48 | def load_backend_module(backend_name, backend_dict): |
no test coverage detected