Changeset View
Changeset View
Standalone View
Standalone View
swh/provenance/__init__.py
Show First 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | if cls in ["local", "postgresql"]: | ||||
) | ) | ||||
elif cls == "mongodb": | elif cls == "mongodb": | ||||
from .mongo.backend import ProvenanceStorageMongoDb | from .mongo.backend import ProvenanceStorageMongoDb | ||||
engine = kwargs.get("engine", "pymongo") | engine = kwargs.get("engine", "pymongo") | ||||
return ProvenanceStorageMongoDb(engine=engine, **kwargs["db"]) | return ProvenanceStorageMongoDb(engine=engine, **kwargs["db"]) | ||||
elif cls in ["remote", "rpcapi"]: | |||||
from .api.client import ProvenanceStorageRPCClient | |||||
if cls == "remote": | |||||
warnings.warn( | |||||
'"remote" class is deprecated for provenance storage, please ' | |||||
'use "rpcapi" class instead.', | |||||
DeprecationWarning, | |||||
) | |||||
rpc_storage = ProvenanceStorageRPCClient(**kwargs) | |||||
if TYPE_CHECKING: | |||||
assert isinstance(rpc_storage, ProvenanceStorageInterface) | |||||
return rpc_storage | |||||
raise ValueError | raise ValueError |