Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
silvanocerza committed Jan 10, 2024
1 parent 2d7abb9 commit 68ae9fa
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion integrations/weaviate/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ exclude_lines = [
module = [
"haystack.*",
"pytest.*",
"weaviate_client.*",
"weaviate.*",
"numpy",
"grpc"
]
Expand Down
27 changes: 14 additions & 13 deletions integrations/weaviate/src/weaviate_haystack/document_store.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
#
# 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]
Expand Down Expand Up @@ -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
8 changes: 4 additions & 4 deletions integrations/weaviate/tests/test_document_store.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 68ae9fa

Please sign in to comment.