diff --git a/libs/text-splitters/langchain_text_splitters/json.py b/libs/text-splitters/langchain_text_splitters/json.py index f3549efc5e094..14353d56d8358 100644 --- a/libs/text-splitters/langchain_text_splitters/json.py +++ b/libs/text-splitters/langchain_text_splitters/json.py @@ -55,14 +55,17 @@ def _json_size(data: dict[str, Any]) -> int: def _set_nested_dict( d: dict[str, Any], path: list[str], - value: Any, + value: Any, # noqa: ANN401 ) -> None: """Set a value in a nested dictionary based on the given path.""" for key in path[:-1]: d = d.setdefault(key, {}) d[path[-1]] = value - def _list_to_dict_preprocessing(self, data: Any) -> Any: + def _list_to_dict_preprocessing( + self, + data: Any, # noqa: ANN401 + ) -> Any: # noqa: ANN401 if isinstance(data, dict): # Process each key-value pair in the dictionary 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: def _json_split( self, - data: Any, + data: Any, # noqa: ANN401 current_path: list[str] | None = None, chunks: list[dict[str, Any]] | None = None, ) -> list[dict[str, Any]]: diff --git a/libs/text-splitters/pyproject.toml b/libs/text-splitters/pyproject.toml index 8334e0756bdd7..0f2807908b992 100644 --- a/libs/text-splitters/pyproject.toml +++ b/libs/text-splitters/pyproject.toml @@ -71,20 +71,14 @@ docstring-code-format = true [tool.ruff.lint] select = [ "ALL",] ignore = [ - "ANN401", # Dynamically typed expressions (typing.Any) "C90", # McCabe complexity - "C901", # Complexity "COM812", # Messes with the formatter + "CPY", # No copyright "FIX002", # Line contains TODO "ISC001", # Messes with the formatter "PERF203", # Rarely useful - "PLR2004", # Magic value used in comparison - "PLR0915", # Too many statements - "PLR0911", # Too many return statements - "PLR0912", # Too many branches - "PLR0913", # Too many arguments in function definition + "PLR09", # Too many something (arg, statements, etc) "RUF012", # Doesn't play well with Pydantic - "S112", # Rarely useful "TC001", # Doesn't play well with Pydantic "TC002", # Doesn't play well with Pydantic "TC003", # Doesn't play well with Pydantic @@ -100,7 +94,6 @@ flake8-annotations.allow-star-arg-any = true flake8-annotations.mypy-init-return = true flake8-type-checking.runtime-evaluated-base-classes = ["pydantic.BaseModel","langchain_core.load.serializable.Serializable","langchain_core.runnables.base.RunnableSerializable"] pep8-naming.classmethod-decorators = [ "classmethod", "langchain_core.utils.pydantic.pre_init", "pydantic.field_validator", "pydantic.v1.root_validator",] -pyupgrade.keep-runtime-typing = true [tool.ruff.lint.pydocstyle] convention = "google"