Skip to content

Commit 9c97cfb

Browse files
committed
Activate ALL Ruff rules with some exclusions
1 parent 0607ad7 commit 9c97cfb

File tree

4 files changed

+52
-17
lines changed

4 files changed

+52
-17
lines changed

libs/astradb/langchain_astradb/vectorstores.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ def similarity_search(
12331233
self,
12341234
query: str,
12351235
k: int = 4,
1236-
filter: dict[str, Any] | None = None, # noqa: A002
1236+
filter: dict[str, Any] | None = None,
12371237
**kwargs: Any,
12381238
) -> list[Document]:
12391239
"""Return docs most similar to query.
@@ -1268,7 +1268,7 @@ async def asimilarity_search(
12681268
self,
12691269
query: str,
12701270
k: int = 4,
1271-
filter: dict[str, Any] | None = None, # noqa: A002
1271+
filter: dict[str, Any] | None = None,
12721272
**kwargs: Any,
12731273
) -> list[Document]:
12741274
"""Return docs most similar to query.
@@ -1307,7 +1307,7 @@ def similarity_search_by_vector(
13071307
self,
13081308
embedding: list[float],
13091309
k: int = 4,
1310-
filter: dict[str, Any] | None = None, # noqa: A002
1310+
filter: dict[str, Any] | None = None,
13111311
**kwargs: Any,
13121312
) -> list[Document]:
13131313
"""Return docs most similar to embedding vector.
@@ -1334,7 +1334,7 @@ async def asimilarity_search_by_vector(
13341334
self,
13351335
embedding: list[float],
13361336
k: int = 4,
1337-
filter: dict[str, Any] | None = None, # noqa: A002
1337+
filter: dict[str, Any] | None = None,
13381338
**kwargs: Any,
13391339
) -> list[Document]:
13401340
"""Return docs most similar to embedding vector.
@@ -1361,7 +1361,7 @@ def similarity_search_with_score(
13611361
self,
13621362
query: str,
13631363
k: int = 4,
1364-
filter: dict[str, Any] | None = None, # noqa: A002
1364+
filter: dict[str, Any] | None = None,
13651365
) -> list[tuple[Document, float]]:
13661366
"""Return docs most similar to query with score.
13671367
@@ -1399,7 +1399,7 @@ async def asimilarity_search_with_score(
13991399
self,
14001400
query: str,
14011401
k: int = 4,
1402-
filter: dict[str, Any] | None = None, # noqa: A002
1402+
filter: dict[str, Any] | None = None,
14031403
) -> list[tuple[Document, float]]:
14041404
"""Return docs most similar to query with score.
14051405
@@ -1530,7 +1530,7 @@ def max_marginal_relevance_search_by_vector(
15301530
k: int = 4,
15311531
fetch_k: int = 20,
15321532
lambda_mult: float = 0.5,
1533-
filter: dict[str, Any] | None = None, # noqa: A002
1533+
filter: dict[str, Any] | None = None,
15341534
**kwargs: Any,
15351535
) -> list[Document]:
15361536
"""Return docs selected using the maximal marginal relevance.
@@ -1568,7 +1568,7 @@ async def amax_marginal_relevance_search_by_vector(
15681568
k: int = 4,
15691569
fetch_k: int = 20,
15701570
lambda_mult: float = 0.5,
1571-
filter: dict[str, Any] | None = None, # noqa: A002
1571+
filter: dict[str, Any] | None = None,
15721572
**kwargs: Any,
15731573
) -> list[Document]:
15741574
"""Return docs selected using the maximal marginal relevance.
@@ -1606,7 +1606,7 @@ def max_marginal_relevance_search(
16061606
k: int = 4,
16071607
fetch_k: int = 20,
16081608
lambda_mult: float = 0.5,
1609-
filter: dict[str, Any] | None = None, # noqa: A002
1609+
filter: dict[str, Any] | None = None,
16101610
**kwargs: Any,
16111611
) -> list[Document]:
16121612
"""Return docs selected using the maximal marginal relevance.
@@ -1655,7 +1655,7 @@ async def amax_marginal_relevance_search(
16551655
k: int = 4,
16561656
fetch_k: int = 20,
16571657
lambda_mult: float = 0.5,
1658-
filter: dict[str, Any] | None = None, # noqa: A002
1658+
filter: dict[str, Any] | None = None,
16591659
**kwargs: Any,
16601660
) -> list[Document]:
16611661
"""Return docs selected using the maximal marginal relevance.

libs/astradb/pyproject.toml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,46 @@ optional = true
6363
langchain-core = { git = "https://github.com/langchain-ai/langchain.git", subdirectory = "libs/core" }
6464

6565
[tool.ruff.lint]
66-
select = [
67-
"E", # pycodestyle
68-
"F", # pyflakes
69-
"I", # isort
66+
pydocstyle.convention = "google"
67+
pep8-naming.classmethod-decorators = [
68+
"langchain_core.pydantic_v1.validator",
69+
]
70+
select = ["ALL"]
71+
ignore = [
72+
"ANN", # Already checked by mypy
73+
"C90", # Do we want to activate (complexity) ?
74+
"COM812", # Messes with the formatter
75+
"D100", # Do we want to activate (docstring in module) ?
76+
"D104", # Do we want to activate (docstring in package) ?
77+
"D105", # Do we want to activate (docstring in magic method) ?
78+
"D107", # Do we want to activate (docstring in __init__) ?
79+
"EM", # Do we want to activate (error messages) ?
80+
"ERA", # Do we want to activate (no commented code) ?
81+
"FBT", # Do we want to activate (boolean trap) ?
82+
"ISC001", # Messes with the formatter
83+
"PERF203", # Incorrect detection
84+
"PLR09", # TODO: do we enforce these ones (complexity) ?
85+
"PTH", # Do we want to activate (use pathlib) ?
86+
"TRY003", # A bit too strict ?
87+
88+
"BLE001", # TODO
89+
"PT011", # TODO
90+
"PT012", # TODO
91+
"D101", # TODO
92+
"D417", # TODO
93+
94+
]
95+
96+
[tool.ruff.lint.per-file-ignores]
97+
"tests/*" = [
98+
"D",
99+
"S101",
100+
"SLF001",
101+
"T201",
102+
"PLR2004",
103+
]
104+
"scripts/*" = [
105+
"T201",
70106
]
71107

72108
[tool.mypy]

libs/astradb/tests/integration_tests/test_caches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ async def aembed_query(self, text: str) -> list[float]:
6565
class FakeLLM(LLM):
6666
"""Fake LLM wrapper for testing purposes."""
6767

68-
queries: Optional[Mapping] = None
69-
sequential_responses: Optional[bool] = False
68+
queries: Optional[Mapping] = None # noqa: UP007
69+
sequential_responses: Optional[bool] = False # noqa: UP007
7070
response_index: int = 0
7171

7272
@validator("queries", always=True)

libs/astradb/tests/integration_tests/test_document_loaders.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@ def test_astradb_loader_findoptions_deprecation(
283283
self,
284284
astra_db_credentials: AstraDBCredentials,
285285
collection: Collection,
286-
core_astra_db: AstraDB,
287286
) -> None:
288287
"""Test deprecation of 'find_options' and related warnings/errors."""
289288
loader0 = AstraDBLoader(

0 commit comments

Comments
 (0)