h
This commit is contained in:
@@ -269,45 +269,7 @@ class Store:
|
||||
# get_backend_instance implementation moved to the bottom of this file to avoid
|
||||
# instantiating all backends during startup (see function `get_backend_instance`).
|
||||
|
||||
def _resolve_backend_name(self, backend_name: str) -> tuple[Optional[str], Optional[str]]:
|
||||
requested = str(backend_name or "")
|
||||
if requested in self._backends:
|
||||
return requested, None
|
||||
|
||||
requested_norm = _normalize_store_type(requested)
|
||||
|
||||
ci_matches = [
|
||||
name for name in self._backends
|
||||
if _normalize_store_type(name) == requested_norm
|
||||
]
|
||||
if len(ci_matches) == 1:
|
||||
return ci_matches[0], None
|
||||
if len(ci_matches) > 1:
|
||||
return None, f"Ambiguous store alias '{backend_name}' matches {ci_matches}"
|
||||
|
||||
type_matches = [
|
||||
name for name, store_type in self._backend_types.items()
|
||||
if store_type == requested_norm
|
||||
]
|
||||
if len(type_matches) == 1:
|
||||
return type_matches[0], None
|
||||
if len(type_matches) > 1:
|
||||
return None, (
|
||||
f"Ambiguous store alias '{backend_name}' matches type '{requested_norm}': {type_matches}"
|
||||
)
|
||||
|
||||
prefix_matches = [
|
||||
name for name, store_type in self._backend_types.items()
|
||||
if store_type.startswith(requested_norm)
|
||||
]
|
||||
if len(prefix_matches) == 1:
|
||||
return prefix_matches[0], None
|
||||
if len(prefix_matches) > 1:
|
||||
return None, (
|
||||
f"Ambiguous store alias '{backend_name}' matches type prefix '{requested_norm}': {prefix_matches}"
|
||||
)
|
||||
|
||||
return None, None
|
||||
# Duplicate _resolve_backend_name removed — the method is defined once earlier in the class.
|
||||
|
||||
def get_backend_error(self, backend_name: str) -> Optional[str]:
|
||||
return self._backend_errors.get(str(backend_name))
|
||||
|
||||
Reference in New Issue
Block a user