From ae3e3042942889d68547480aff60db67e2bf0d9b Mon Sep 17 00:00:00 2001 From: Christophe Bornet Date: Tue, 27 Aug 2024 18:15:11 +0200 Subject: [PATCH 1/2] Activate ruff rules BLE --- libs/astradb/pyproject.toml | 1 - libs/astradb/tests/integration_tests/test_vectorstores.py | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/libs/astradb/pyproject.toml b/libs/astradb/pyproject.toml index 177da7a..bb910c6 100644 --- a/libs/astradb/pyproject.toml +++ b/libs/astradb/pyproject.toml @@ -77,7 +77,6 @@ ignore = [ "PLR09", # TODO: do we enforce these ones (complexity) ? "PTH", # Do we want to activate (use pathlib) ? - "BLE001", # TODO "PT011", # TODO "PT012", # TODO "D101", # TODO diff --git a/libs/astradb/tests/integration_tests/test_vectorstores.py b/libs/astradb/tests/integration_tests/test_vectorstores.py index 436978f..b7357c6 100644 --- a/libs/astradb/tests/integration_tests/test_vectorstores.py +++ b/libs/astradb/tests/integration_tests/test_vectorstores.py @@ -74,13 +74,7 @@ def is_nvidia_vector_service_available() -> bool: # For the time being, this is manually controlled - if os.environ.get("NVIDIA_VECTORIZE_AVAILABLE"): - try: - return int(os.environ["NVIDIA_VECTORIZE_AVAILABLE"]) != 0 - except Exception: - return False - else: - return False + return os.getenv("NVIDIA_VECTORIZE_AVAILABLE") == "1" @pytest.fixture() From 1cad0674a6dacae9c602aad56d374021fedf8f0c Mon Sep 17 00:00:00 2001 From: Stefano Lottini Date: Wed, 28 Aug 2024 17:51:50 +0200 Subject: [PATCH 2/2] nit: backward compat in the NVIDIA_VECTORIZE_AVAILABLE parsing --- .../tests/integration_tests/test_vectorstores.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/astradb/tests/integration_tests/test_vectorstores.py b/libs/astradb/tests/integration_tests/test_vectorstores.py index 89a02de..2214edf 100644 --- a/libs/astradb/tests/integration_tests/test_vectorstores.py +++ b/libs/astradb/tests/integration_tests/test_vectorstores.py @@ -74,7 +74,15 @@ def is_nvidia_vector_service_available() -> bool: # For the time being, this is manually controlled - return os.getenv("NVIDIA_VECTORIZE_AVAILABLE") == "1" + if os.environ.get("NVIDIA_VECTORIZE_AVAILABLE"): + try: + # any non-zero counts as true: + return int(os.environ["NVIDIA_VECTORIZE_AVAILABLE"]) != 0 + except (TypeError, ValueError): + # the env var has unparsable contents: + return False + else: + return False @pytest.fixture