From 49e674c0a9f05cc7b6a48dae3bd78e9f92b33eb5 Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Tue, 27 Aug 2024 17:06:31 +0200 Subject: [PATCH] Activate ruff ANN rules Although ruff doesn't check types, ANN rules can catch some issues much faster than mypy --- libs/astradb/langchain_astradb/storage.py | 4 ++-- libs/astradb/pyproject.toml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/astradb/langchain_astradb/storage.py b/libs/astradb/langchain_astradb/storage.py index ea62d96..d8aba18 100644 --- a/libs/astradb/langchain_astradb/storage.py +++ b/libs/astradb/langchain_astradb/storage.py @@ -54,11 +54,11 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: self.async_collection = self.astra_env.async_collection @abstractmethod - def decode_value(self, value: Any) -> V | None: + def decode_value(self, value: Any) -> V | None: # noqa: ANN401 """Decodes value from Astra DB.""" @abstractmethod - def encode_value(self, value: V | None) -> Any: + def encode_value(self, value: V | None) -> Any: # noqa: ANN401 """Encodes value for Astra DB.""" @override diff --git a/libs/astradb/pyproject.toml b/libs/astradb/pyproject.toml index 177da7a..81b28d2 100644 --- a/libs/astradb/pyproject.toml +++ b/libs/astradb/pyproject.toml @@ -67,9 +67,10 @@ pydocstyle.convention = "google" pep8-naming.classmethod-decorators = [ "langchain_core.pydantic_v1.validator", ] +flake8-annotations.allow-star-arg-any = true +flake8-annotations.mypy-init-return = true select = ["ALL"] ignore = [ - "ANN", # Already checked by mypy "C90", # Do we want to activate (complexity) ? "COM812", # Messes with the formatter "ERA", # Do we want to activate (no commented code) ?