Skip to content

Commit 20e04fc

Browse files
cbornetmdrxy
andauthored
chore(text-splitters): cleanup ruff config (#33247)
Co-authored-by: Mason Daugherty <[email protected]>
1 parent 078137f commit 20e04fc

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

libs/text-splitters/langchain_text_splitters/json.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@ def _json_size(data: dict[str, Any]) -> int:
5555
def _set_nested_dict(
5656
d: dict[str, Any],
5757
path: list[str],
58-
value: Any,
58+
value: Any, # noqa: ANN401
5959
) -> None:
6060
"""Set a value in a nested dictionary based on the given path."""
6161
for key in path[:-1]:
6262
d = d.setdefault(key, {})
6363
d[path[-1]] = value
6464

65-
def _list_to_dict_preprocessing(self, data: Any) -> Any:
65+
def _list_to_dict_preprocessing(
66+
self,
67+
data: Any, # noqa: ANN401
68+
) -> Any: # noqa: ANN401
6669
if isinstance(data, dict):
6770
# Process each key-value pair in the dictionary
6871
return {k: self._list_to_dict_preprocessing(v) for k, v in data.items()}
@@ -77,7 +80,7 @@ def _list_to_dict_preprocessing(self, data: Any) -> Any:
7780

7881
def _json_split(
7982
self,
80-
data: Any,
83+
data: Any, # noqa: ANN401
8184
current_path: list[str] | None = None,
8285
chunks: list[dict[str, Any]] | None = None,
8386
) -> list[dict[str, Any]]:

libs/text-splitters/pyproject.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,14 @@ docstring-code-format = true
7171
[tool.ruff.lint]
7272
select = [ "ALL",]
7373
ignore = [
74-
"ANN401", # Dynamically typed expressions (typing.Any)
7574
"C90", # McCabe complexity
76-
"C901", # Complexity
7775
"COM812", # Messes with the formatter
76+
"CPY", # No copyright
7877
"FIX002", # Line contains TODO
7978
"ISC001", # Messes with the formatter
8079
"PERF203", # Rarely useful
81-
"PLR2004", # Magic value used in comparison
82-
"PLR0915", # Too many statements
83-
"PLR0911", # Too many return statements
84-
"PLR0912", # Too many branches
85-
"PLR0913", # Too many arguments in function definition
80+
"PLR09", # Too many something (arg, statements, etc)
8681
"RUF012", # Doesn't play well with Pydantic
87-
"S112", # Rarely useful
8882
"TC001", # Doesn't play well with Pydantic
8983
"TC002", # Doesn't play well with Pydantic
9084
"TC003", # Doesn't play well with Pydantic
@@ -100,7 +94,6 @@ flake8-annotations.allow-star-arg-any = true
10094
flake8-annotations.mypy-init-return = true
10195
flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"]
10296
pep8-naming.classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",]
103-
pyupgrade.keep-runtime-typing = true
10497

10598
[tool.ruff.lint.pydocstyle]
10699
convention = "google"

0 commit comments

Comments
 (0)