Skip to content

Commit

Permalink
fix: fix type hints on DocumentStore protocol (#6383)
Browse files Browse the repository at this point in the history
* fix type hints

* disable specific pylint checker
  • Loading branch information
masci authored Nov 23, 2023
1 parent e91f7a8 commit 70e40ea
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions haystack/preview/document_stores/protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)


Expand All @@ -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]:
"""
Expand Down Expand Up @@ -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:
"""
Expand All @@ -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:
"""
Expand All @@ -136,3 +144,4 @@ def delete_documents(self, document_ids: List[str]) -> None:
:param object_ids: the object_ids to delete
"""
...

0 comments on commit 70e40ea

Please sign in to comment.