diff --git a/integrations/cohere/pyproject.toml b/integrations/cohere/pyproject.toml index 53b7d7febe..90220b2c5c 100644 --- a/integrations/cohere/pyproject.toml +++ b/integrations/cohere/pyproject.toml @@ -84,6 +84,7 @@ line-length = 120 [tool.ruff.lint] select = [ "A", + "ANN", "ARG", "B", "C", @@ -124,6 +125,8 @@ ignore = [ # Misc "B008", "S101", + # Allow `Any` - used legitimately for dynamic types and SDK boundaries + "ANN401", ] [tool.ruff.lint.isort] @@ -133,8 +136,8 @@ known-first-party = ["haystack_integrations"] ban-relative-imports = "parents" [tool.ruff.lint.per-file-ignores] -# Tests can use magic values, assertions, and relative imports -"tests/**/*" = ["PLR2004", "S101", "TID252"] +# Tests can use magic values, assertions, relative imports, and don't need type annotations +"tests/**/*" = ["PLR2004", "S101", "TID252", "ANN"] [tool.coverage.run] source = ["haystack_integrations"] diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py index 1658219143..4edefe7597 100644 --- a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py +++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/document_embedder.py @@ -49,7 +49,7 @@ def __init__( meta_fields_to_embed: list[str] | None = None, embedding_separator: str = "\n", embedding_type: EmbeddingTypes | None = None, - ): + ) -> None: """ :param api_key: the Cohere API key. :param model: the name of the model to use. Supported Models are: diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py index 2f11c02cb8..d64d86fe3d 100644 --- a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py +++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py @@ -21,7 +21,7 @@ class EmbeddingTypes(Enum): BINARY = "binary" UBINARY = "ubinary" - def __str__(self): + def __str__(self) -> str: return self.value @staticmethod diff --git a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py index cb2694d3ff..f29543e533 100644 --- a/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py +++ b/integrations/cohere/src/haystack_integrations/components/embedders/cohere/text_embedder.py @@ -41,7 +41,7 @@ def __init__( truncate: str = "END", timeout: float = 120.0, embedding_type: EmbeddingTypes | None = None, - ): + ) -> None: """ :param api_key: the Cohere API key. :param model: the name of the model to use. Supported Models are: diff --git a/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py index 1205e6ef09..5d47d4d35c 100644 --- a/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py +++ b/integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/chat_generator.py @@ -491,7 +491,7 @@ def __init__( *, timeout: float | None = None, max_retries: int | None = None, - ): + ) -> None: """ Initialize the CohereChatGenerator instance. diff --git a/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py b/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py index 9f31eff15e..a171d9984f 100644 --- a/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py +++ b/integrations/cohere/src/haystack_integrations/components/generators/cohere/generator.py @@ -37,7 +37,7 @@ def __init__( streaming_callback: Callable | None = None, api_base_url: str | None = None, **kwargs: Any, - ): + ) -> None: """ Instantiates a `CohereGenerator` component. diff --git a/integrations/cohere/src/haystack_integrations/components/rankers/cohere/ranker.py b/integrations/cohere/src/haystack_integrations/components/rankers/cohere/ranker.py index 824e1feec8..8697e5fe07 100644 --- a/integrations/cohere/src/haystack_integrations/components/rankers/cohere/ranker.py +++ b/integrations/cohere/src/haystack_integrations/components/rankers/cohere/ranker.py @@ -41,7 +41,7 @@ def __init__( meta_fields_to_embed: list[str] | None = None, meta_data_separator: str = "\n", max_tokens_per_doc: int = 4096, - ): + ) -> None: """ Creates an instance of the 'CohereRanker'.