mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-26 00:24:14 +00:00
fix: fix type hints on DocumentStore
protocol (#6383)
* fix type hints * disable specific pylint checker
This commit is contained in:
parent
e91f7a8a4d
commit
70e40eae5c
@ -5,6 +5,9 @@ from enum import Enum
|
||||
from haystack.preview.dataclasses import Document
|
||||
|
||||
|
||||
# Ellipsis are needed for the type checker, it's safe to disable module-wide
|
||||
# pylint: disable=unnecessary-ellipsis
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -29,17 +32,20 @@ class DocumentStore(Protocol):
|
||||
"""
|
||||
Serializes this store to a dictionary.
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data: Dict[str, Any]) -> "DocumentStore":
|
||||
"""
|
||||
Deserializes the store from a dictionary.
|
||||
"""
|
||||
...
|
||||
|
||||
def count_documents(self) -> int:
|
||||
"""
|
||||
Returns the number of documents stored.
|
||||
"""
|
||||
...
|
||||
|
||||
def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Document]:
|
||||
"""
|
||||
@ -112,6 +118,7 @@ class DocumentStore(Protocol):
|
||||
:param filters: the filters to apply to the document list.
|
||||
:return: a list of Documents that match the given filters.
|
||||
"""
|
||||
...
|
||||
|
||||
def write_documents(self, documents: List[Document], policy: DuplicatePolicy = DuplicatePolicy.FAIL) -> int:
|
||||
"""
|
||||
@ -128,6 +135,7 @@ class DocumentStore(Protocol):
|
||||
If DuplicatePolicy.OVERWRITE is used, this number is always equal to the number of documents in input.
|
||||
If DuplicatePolicy.SKIP is used, this number can be lower than the number of documents in the input list.
|
||||
"""
|
||||
...
|
||||
|
||||
def delete_documents(self, document_ids: List[str]) -> None:
|
||||
"""
|
||||
@ -136,3 +144,4 @@ class DocumentStore(Protocol):
|
||||
|
||||
:param object_ids: the object_ids to delete
|
||||
"""
|
||||
...
|
||||
|
Loading…
x
Reference in New Issue
Block a user