Skip to content

Commit 47aa76f

Browse files
julian-rischclaude
andcommitted
chore: enable ANN ruff ruleset for cohere integration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent fc82ec4 commit 47aa76f

7 files changed

Lines changed: 11 additions & 8 deletions

File tree

integrations/cohere/pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ line-length = 120
8484
[tool.ruff.lint]
8585
select = [
8686
"A",
87+
"ANN",
8788
"ARG",
8889
"B",
8990
"C",
@@ -124,6 +125,8 @@ ignore = [
124125
# Misc
125126
"B008",
126127
"S101",
128+
# Allow `Any` - used legitimately for dynamic types and SDK boundaries
129+
"ANN401",
127130
]
128131

129132
[tool.ruff.lint.isort]
@@ -133,8 +136,8 @@ known-first-party = ["haystack_integrations"]
133136
ban-relative-imports = "parents"
134137

135138
[tool.ruff.lint.per-file-ignores]
136-
# Tests can use magic values, assertions, and relative imports
137-
"tests/**/*" = ["PLR2004", "S101", "TID252"]
139+
# Tests can use magic values, assertions, relative imports, and don't need type annotations
140+
"tests/**/*" = ["PLR2004", "S101", "TID252", "ANN"]
138141

139142
[tool.coverage.run]
140143
source = ["haystack_integrations"]

integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def __init__(
4949
meta_fields_to_embed: list[str] | None = None,
5050
embedding_separator: str = "\n",
5151
embedding_type: EmbeddingTypes | None = None,
52-
):
52+
) -> None:
5353
"""
5454
:param api_key: the Cohere API key.
5555
:param model: the name of the model to use. Supported Models are:

integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class EmbeddingTypes(Enum):
2121
BINARY = "binary"
2222
UBINARY = "ubinary"
2323

24-
def __str__(self):
24+
def __str__(self) -> str:
2525
return self.value
2626

2727
@staticmethod

integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
truncate: str = "END",
4242
timeout: float = 120.0,
4343
embedding_type: EmbeddingTypes | None = None,
44-
):
44+
) -> None:
4545
"""
4646
:param api_key: the Cohere API key.
4747
:param model: the name of the model to use. Supported Models are:

integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ def __init__(
491491
*,
492492
timeout: float | None = None,
493493
max_retries: int | None = None,
494-
):
494+
) -> None:
495495
"""
496496
Initialize the CohereChatGenerator instance.
497497

integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(
3737
streaming_callback: Callable | None = None,
3838
api_base_url: str | None = None,
3939
**kwargs: Any,
40-
):
40+
) -> None:
4141
"""
4242
Instantiates a `CohereGenerator` component.
4343

integrations/cohere/src/haystack_integrations/components/rankers/cohere/ranker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def __init__(
4141
meta_fields_to_embed: list[str] | None = None,
4242
meta_data_separator: str = "\n",
4343
max_tokens_per_doc: int = 4096,
44-
):
44+
) -> None:
4545
"""
4646
Creates an instance of the 'CohereRanker'.
4747

0 commit comments

Comments
 (0)