From 68ae9fa7c6816a13507aa8cb7a10f1a66f8b6d45 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Wed, 10 Jan 2024 18:39:53 +0100 Subject: [PATCH] Fix linting --- integrations/weaviate/pyproject.toml | 2 +- .../src/weaviate_haystack/document_store.py | 27 ++++++++++--------- .../weaviate/tests/test_document_store.py | 8 +++--- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/integrations/weaviate/pyproject.toml b/integrations/weaviate/pyproject.toml index 3e6170ce9..c90d70046 100644 --- a/integrations/weaviate/pyproject.toml +++ b/integrations/weaviate/pyproject.toml @@ -169,7 +169,7 @@ exclude_lines = [ module = [ "haystack.*", "pytest.*", - "weaviate_client.*", + "weaviate.*", "numpy", "grpc" ] diff --git a/integrations/weaviate/src/weaviate_haystack/document_store.py b/integrations/weaviate/src/weaviate_haystack/document_store.py index ba48241fe..263d96aad 100644 --- a/integrations/weaviate/src/weaviate_haystack/document_store.py +++ b/integrations/weaviate/src/weaviate_haystack/document_store.py @@ -1,17 +1,16 @@ # SPDX-FileCopyrightText: 2023-present deepset GmbH # # SPDX-License-Identifier: Apache-2.0 -from typing import Union, Dict, Tuple, Optional, List, Any from dataclasses import asdict +from typing import Any, Dict, List, Optional, Tuple, Union import weaviate -from weaviate.auth import AuthCredentials -from weaviate.embedded import EmbeddedOptions -from weaviate.config import Config, ConnectionConfig - -from haystack.core.serialization import default_to_dict, default_from_dict +from haystack.core.serialization import default_from_dict, default_to_dict from haystack.dataclasses.document import Document from haystack.document_stores.protocol import DuplicatePolicy +from weaviate.auth import AuthCredentials +from weaviate.config import Config, ConnectionConfig +from weaviate.embedded import EmbeddedOptions Number = Union[int, float] TimeoutType = Union[Tuple[Number, Number], Number] @@ -144,13 +143,15 @@ def from_dict(cls, data: Dict[str, Any]) -> "WeaviateDocumentStore": ) def count_documents(self) -> int: - ... + return 0 - def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Document]: - ... + def filter_documents(self, filters: Optional[Dict[str, Any]] = None) -> List[Document]: # noqa: ARG002 + return [] - def write_documents(self, documents: List[Document], policy: DuplicatePolicy = DuplicatePolicy.NONE) -> int: - ... + def write_documents( + self, documents: List[Document], policy: DuplicatePolicy = DuplicatePolicy.NONE # noqa: ARG002 + ) -> int: + return 0 - def delete_documents(self, document_ids: List[str]) -> None: - ... + def delete_documents(self, document_ids: List[str]) -> None: # noqa: ARG002 + return diff --git a/integrations/weaviate/tests/test_document_store.py b/integrations/weaviate/tests/test_document_store.py index 90ac4e848..69e7c36b5 100644 --- a/integrations/weaviate/tests/test_document_store.py +++ b/integrations/weaviate/tests/test_document_store.py @@ -1,14 +1,14 @@ from unittest.mock import patch from weaviate.auth import AuthApiKey +from weaviate.config import Config from weaviate.embedded import ( - EmbeddedOptions, DEFAULT_BINARY_PATH, + DEFAULT_GRPC_PORT, DEFAULT_PERSISTENCE_DATA_PATH, DEFAULT_PORT, - DEFAULT_GRPC_PORT, + EmbeddedOptions, ) -from weaviate.config import Config from weaviate_haystack.document_store import WeaviateDocumentStore @@ -109,7 +109,7 @@ def test_from_dict(self, _mock_weaviate): assert document_store._embedded_options.version == "1.23.0" assert document_store._embedded_options.port == DEFAULT_PORT assert document_store._embedded_options.hostname == "127.0.0.1" - assert document_store._embedded_options.additional_env_vars == None + assert document_store._embedded_options.additional_env_vars is None assert document_store._embedded_options.grpc_port == DEFAULT_GRPC_PORT assert document_store._additional_config.grpc_port_experimental == 12345 assert document_store._additional_config.connection_config.session_pool_connections == 20