"""Dependency-free resolver for known Depth Anything 3 package layouts.""" from __future__ import annotations import importlib def resolve_da3_class(importer=importlib.import_module): """Return ``(DepthAnything3, module_name)`` or a useful ImportError.""" errors = [] for location in ("depth_anything_3.api", "depth_anything_3"): try: module = importer(location) candidate = getattr(module, "DepthAnything3", None) if candidate is not None: return candidate, location errors.append(f"{location}: DepthAnything3 is missing") except (ImportError, ModuleNotFoundError, AttributeError) as exc: errors.append(f"{location}: {type(exc).__name__}: {exc}") raise ImportError("; ".join(errors))