From 70e40eae5c6d38c6902edbb269a88d517a44c74e Mon Sep 17 00:00:00 2001 From: Massimiliano Pippi Date: Thu, 23 Nov 2023 09:14:08 +0100 Subject: [PATCH] fix: fix type hints on `DocumentStore` protocol (#6383) * fix type hints * disable specific pylint checker --- haystack/preview/document_stores/protocols.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/haystack/preview/document_stores/protocols.py b/haystack/preview/document_stores/protocols.py index d4efd2a479..d011552892 100644 --- a/haystack/preview/document_stores/protocols.py +++ b/haystack/preview/document_stores/protocols.py @@ -5,6 +5,9 @@ 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 @@ def to_dict(self) -> Dict[str, Any]: """ 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 @@ def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Doc :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 @@ def write_documents(self, documents: List[Document], policy: DuplicatePolicy = D 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 @@ def delete_documents(self, document_ids: List[str]) -> None: :param object_ids: the object_ids to delete """ + ...