mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-26 16:46:58 +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
|
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__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -29,17 +32,20 @@ class DocumentStore(Protocol):
|
|||||||
"""
|
"""
|
||||||
Serializes this store to a dictionary.
|
Serializes this store to a dictionary.
|
||||||
"""
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_dict(cls, data: Dict[str, Any]) -> "DocumentStore":
|
def from_dict(cls, data: Dict[str, Any]) -> "DocumentStore":
|
||||||
"""
|
"""
|
||||||
Deserializes the store from a dictionary.
|
Deserializes the store from a dictionary.
|
||||||
"""
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def count_documents(self) -> int:
|
def count_documents(self) -> int:
|
||||||
"""
|
"""
|
||||||
Returns the number of documents stored.
|
Returns the number of documents stored.
|
||||||
"""
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Document]:
|
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.
|
:param filters: the filters to apply to the document list.
|
||||||
:return: a list of Documents that match the given filters.
|
:return: a list of Documents that match the given filters.
|
||||||
"""
|
"""
|
||||||
|
...
|
||||||
|
|
||||||
def write_documents(self, documents: List[Document], policy: DuplicatePolicy = DuplicatePolicy.FAIL) -> int:
|
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.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.
|
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:
|
def delete_documents(self, document_ids: List[str]) -> None:
|
||||||
"""
|
"""
|
||||||
@ -136,3 +144,4 @@ class DocumentStore(Protocol):
|
|||||||
|
|
||||||
:param object_ids: the object_ids to delete
|
:param object_ids: the object_ids to delete
|
||||||
"""
|
"""
|
||||||
|
...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user