langchain/libs/community/langchain_community/storage/__init__.py
Charlie Marsh 8f38b7a725
multiple: Remove unnecessary Ruff suppression comments (#21050)
## Summary

I ran `ruff check --extend-select RUF100 -n` to identify `# noqa`
comments that weren't having any effect in Ruff, and then `ruff check
--extend-select RUF100 -n --fix` on select files to remove all of the
unnecessary `# noqa: F401` violations. It's possible that these were
needed at some point in the past, but they're not necessary in Ruff
v0.1.15 (used by LangChain) or in the latest release.

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-30 17:13:48 +00:00

63 lines
1.6 KiB
Python

"""**Storage** is an implementation of key-value store.
Storage module provides implementations of various key-value stores that conform
to a simple key-value interface.
The primary goal of these storages is to support caching.
**Class hierarchy:**
.. code-block::
BaseStore --> <name>Store # Examples: MongoDBStore, RedisStore
"""
import importlib
from typing import TYPE_CHECKING, Any
if TYPE_CHECKING:
from langchain_community.storage.astradb import (
AstraDBByteStore,
AstraDBStore,
)
from langchain_community.storage.mongodb import (
MongoDBStore,
)
from langchain_community.storage.redis import (
RedisStore,
)
from langchain_community.storage.upstash_redis import (
UpstashRedisByteStore,
UpstashRedisStore,
)
__all__ = [
"AstraDBByteStore",
"AstraDBStore",
"MongoDBStore",
"RedisStore",
"UpstashRedisByteStore",
"UpstashRedisStore",
]
_module_lookup = {
"AstraDBByteStore": "langchain_community.storage.astradb",
"AstraDBStore": "langchain_community.storage.astradb",
"MongoDBStore": "langchain_community.storage.mongodb",
"RedisStore": "langchain_community.storage.redis",
"UpstashRedisByteStore": "langchain_community.storage.upstash_redis",
"UpstashRedisStore": "langchain_community.storage.upstash_redis",
}
def __getattr__(name: str) -> Any:
if name in _module_lookup:
module = importlib.import_module(_module_lookup[name])
return getattr(module, name)
raise AttributeError(f"module {__name__} has no attribute {name}")
__all__ = list(_module_lookup.keys())