Skip to content

Commit 0666586

Browse files
authored
chore: fix linting for ruff 0.12.0 (#1969)
* chore: fix linting for ruff 0.12.0 * fix mcp * try fixing astra
1 parent e6a13ef commit 0666586

File tree

8 files changed

+20
-13
lines changed

8 files changed

+20
-13
lines changed

integrations/astra/src/haystack_integrations/document_stores/astra/astra_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ def __init__(
144144

145145
def query(
146146
self,
147+
*,
147148
vector: Optional[List[float]] = None,
148149
query_filter: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None,
149150
top_k: Optional[int] = None,
@@ -317,6 +318,7 @@ def update_document(self, document: Dict, id_key: str):
317318

318319
def delete(
319320
self,
321+
*,
320322
ids: Optional[List[str]] = None,
321323
delete_all: Optional[bool] = None,
322324
filters: Optional[Dict[str, Union[str, float, int, bool, List, dict]]] = None,

integrations/astra/src/haystack_integrations/document_stores/astra/document_store.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,12 @@ def search(
392392

393393
return result
394394

395-
def delete_documents(self, document_ids: Optional[List[str]] = None, delete_all: Optional[bool] = None) -> None:
395+
def delete_documents(
396+
self,
397+
document_ids: Optional[List[str]] = None,
398+
*,
399+
delete_all: Optional[bool] = None,
400+
) -> None:
396401
"""
397402
Deletes documents from the document store.
398403

integrations/astra/tests/test_document_store.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-FileCopyrightText: 2023-present Anant Corporation <[email protected]>
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
import operator
45
import os
56
from typing import List
67
from unittest import mock
@@ -78,8 +79,6 @@ def assert_documents_are_equal(self, received: List[Document], expected: List[Do
7879
This can happen for example when the Document Store sets a score to returned Documents.
7980
Since we can't know what the score will be, we can't compare the Documents reliably.
8081
"""
81-
import operator
82-
8382
received.sort(key=operator.attrgetter("id"))
8483
expected.sort(key=operator.attrgetter("id"))
8584
assert received == expected

integrations/github/src/haystack_integrations/components/connectors/github/repo_forker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44
import re
5+
import time
56
from typing import Any, Dict, Optional
67

78
import requests
@@ -274,8 +275,6 @@ def run(self, url: str) -> dict:
274275

275276
# Wait for fork completion if requested
276277
if self.wait_for_completion:
277-
import time
278-
279278
start_time = time.time()
280279

281280
while time.time() - start_time < self.max_wait_seconds:

integrations/google_genai/tests/test_chat_generator.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@
99
from haystack.tools import Tool, Toolset
1010
from haystack.utils.auth import Secret
1111

12-
from haystack_integrations.components.generators.google_genai import GoogleGenAIChatGenerator
12+
from haystack_integrations.components.generators.google_genai.chat.chat_generator import (
13+
GoogleGenAIChatGenerator,
14+
_convert_message_to_google_genai_format,
15+
)
1316

1417

1518
@pytest.fixture
@@ -112,11 +115,6 @@ def test_convert_message_to_google_genai_format_complex(self):
112115
Test that the GoogleGenAIChatGenerator can convert a complex sequence of ChatMessages to Google GenAI format.
113116
In particular, we check that different tool results are handled properly in sequence.
114117
"""
115-
from haystack.dataclasses import ToolCall
116-
117-
from haystack_integrations.components.generators.google_genai.chat.chat_generator import (
118-
_convert_message_to_google_genai_format,
119-
)
120118

121119
messages = [
122120
ChatMessage.from_system("You are good assistant"),

integrations/mcp/src/haystack_integrations/tools/mcp/mcp_tool.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from typing import Any, cast
1616

1717
from anyio.streams.memory import MemoryObjectReceiveStream, MemoryObjectSendStream
18+
from exceptiongroup import ExceptionGroup
1819
from haystack import logging
1920
from haystack.core.serialization import generate_qualified_class_name, import_class_by_name
2021
from haystack.tools import Tool
@@ -749,8 +750,6 @@ def __init__(
749750
self.close()
750751

751752
# Extract more detailed error information from TaskGroup/ExceptionGroup exceptions
752-
from exceptiongroup import ExceptionGroup
753-
754753
error_message = str(e)
755754
# Handle ExceptionGroup to extract more useful error messages
756755
if isinstance(e, ExceptionGroup):

integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/bm25_retriever.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# SPDX-FileCopyrightText: 2023-present deepset GmbH <[email protected]>
22
#
33
# SPDX-License-Identifier: Apache-2.0
4+
5+
# ruff: noqa: FBT001 Boolean-typed positional argument in function definition
6+
47
from typing import Any, Dict, List, Optional, Union
58

69
from haystack import component, default_from_dict, default_to_dict, logging

integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/embedding_retriever.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5+
# ruff: noqa: FBT001 Boolean-typed positional argument in function definition
6+
57
from typing import Any, Dict, List, Optional, Union
68

79
from haystack import component, default_from_dict, default_to_dict, logging

0 commit comments

Comments
 (0)