df
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
Some checks failed
smoke-mm / Install & smoke test mm --help (push) Has been cancelled
This commit is contained in:
@@ -88,7 +88,9 @@ def _required_keys_for(store_cls: Type[BaseStore]) -> list[str]:
|
||||
raise TypeError(f"Unsupported __new__.keys type for {store_cls.__name__}: {type(keys)}")
|
||||
|
||||
|
||||
def _build_kwargs(store_cls: Type[BaseStore], instance_name: str, instance_config: Any) -> Dict[str, Any]:
|
||||
def _build_kwargs(
|
||||
store_cls: Type[BaseStore], instance_name: str, instance_config: Any
|
||||
) -> Dict[str, Any]:
|
||||
if isinstance(instance_config, dict):
|
||||
cfg_dict = dict(instance_config)
|
||||
else:
|
||||
@@ -97,7 +99,10 @@ def _build_kwargs(store_cls: Type[BaseStore], instance_name: str, instance_confi
|
||||
required = _required_keys_for(store_cls)
|
||||
|
||||
# If NAME is required but not present, allow the instance key to provide it.
|
||||
if any(_normalize_config_key(k) == "NAME" for k in required) and _get_case_insensitive(cfg_dict, "NAME") is None:
|
||||
if (
|
||||
any(_normalize_config_key(k) == "NAME" for k in required)
|
||||
and _get_case_insensitive(cfg_dict, "NAME") is None
|
||||
):
|
||||
cfg_dict["NAME"] = str(instance_name)
|
||||
|
||||
kwargs: Dict[str, Any] = {}
|
||||
@@ -116,14 +121,18 @@ def _build_kwargs(store_cls: Type[BaseStore], instance_name: str, instance_confi
|
||||
|
||||
|
||||
class Store:
|
||||
def __init__(self, config: Optional[Dict[str, Any]] = None, suppress_debug: bool = False) -> None:
|
||||
def __init__(
|
||||
self, config: Optional[Dict[str, Any]] = None, suppress_debug: bool = False
|
||||
) -> None:
|
||||
self._config = config or {}
|
||||
self._suppress_debug = suppress_debug
|
||||
self._backends: Dict[str, BaseStore] = {}
|
||||
self._backend_errors: Dict[str, str] = {}
|
||||
self._load_backends()
|
||||
|
||||
def _maybe_register_temp_alias(self, store_type: str, backend_name: str, kwargs: Dict[str, Any], backend: BaseStore) -> None:
|
||||
def _maybe_register_temp_alias(
|
||||
self, store_type: str, backend_name: str, kwargs: Dict[str, Any], backend: BaseStore
|
||||
) -> None:
|
||||
"""If a folder backend points at config['temp'], also expose it as the 'temp' backend.
|
||||
|
||||
This keeps config compatibility (e.g. existing 'default') while presenting the temp
|
||||
@@ -236,7 +245,9 @@ class Store:
|
||||
|
||||
def __getitem__(self, backend_name: str) -> BaseStore:
|
||||
if backend_name not in self._backends:
|
||||
raise KeyError(f"Unknown store backend: {backend_name}. Available: {list(self._backends.keys())}")
|
||||
raise KeyError(
|
||||
f"Unknown store backend: {backend_name}. Available: {list(self._backends.keys())}"
|
||||
)
|
||||
return self._backends[backend_name]
|
||||
|
||||
def is_available(self, backend_name: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user