ruff: add bugbear across packages (#31917)

WIP, other packages will get in next PRs
This commit is contained in:
Mason Daugherty
2025-07-08 12:22:55 -04:00
committed by GitHub
parent 5b3e29f809
commit ae210c1590
33 changed files with 59 additions and 42 deletions

View File

@@ -479,7 +479,7 @@ class Chroma(VectorStore):
"Try filtering complex metadata using "
"langchain_community.vectorstores.utils.filter_complex_metadata."
)
raise ValueError(e.args[0] + "\n\n" + msg)
raise ValueError(e.args[0] + "\n\n" + msg) from e
raise e
if empty_ids:
images_without_metadatas = [b64_texts[j] for j in empty_ids]
@@ -566,7 +566,7 @@ class Chroma(VectorStore):
"Try filtering complex metadata from the document using "
"langchain_community.vectorstores.utils.filter_complex_metadata."
)
raise ValueError(e.args[0] + "\n\n" + msg)
raise ValueError(e.args[0] + "\n\n" + msg) from e
raise e
if empty_ids:
texts_without_metadatas = [texts[j] for j in empty_ids]

View File

@@ -64,6 +64,7 @@ target-version = "py39"
[tool.ruff.lint]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"ASYNC", # flake8-async
"C4", # flake8-comprehensions
"COM", # flake8-commas

View File

@@ -787,7 +787,7 @@ def test_collection_none_after_delete(
_ = vectorstore._collection
with pytest.raises(Exception, match="does not exist"):
vectorstore._client.get_collection("test_collection")
with pytest.raises(Exception):
with pytest.raises(Exception): # noqa: B017
vectorstore.similarity_search("foo")