mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
8f38b7a725
## 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>
49 lines
1.1 KiB
Python
49 lines
1.1 KiB
Python
"""**Docstores** are classes to store and load Documents.
|
|
|
|
The **Docstore** is a simplified version of the Document Loader.
|
|
|
|
**Class hierarchy:**
|
|
|
|
.. code-block::
|
|
|
|
Docstore --> <name> # Examples: InMemoryDocstore, Wikipedia
|
|
|
|
**Main helpers:**
|
|
|
|
.. code-block::
|
|
|
|
Document, AddableMixin
|
|
"""
|
|
|
|
import importlib
|
|
from typing import TYPE_CHECKING, Any
|
|
|
|
if TYPE_CHECKING:
|
|
from langchain_community.docstore.arbitrary_fn import (
|
|
DocstoreFn,
|
|
)
|
|
from langchain_community.docstore.in_memory import (
|
|
InMemoryDocstore,
|
|
)
|
|
from langchain_community.docstore.wikipedia import (
|
|
Wikipedia,
|
|
)
|
|
|
|
__all__ = ["DocstoreFn", "InMemoryDocstore", "Wikipedia"]
|
|
|
|
_module_lookup = {
|
|
"DocstoreFn": "langchain_community.docstore.arbitrary_fn",
|
|
"InMemoryDocstore": "langchain_community.docstore.in_memory",
|
|
"Wikipedia": "langchain_community.docstore.wikipedia",
|
|
}
|
|
|
|
|
|
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())
|