core: Add ruff rules PGH (except PGH003) (#30656)

Add ruff rules PGH: https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
Except PGH003 which will be dealt in a dedicated PR.

---------

Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
Co-authored-by: Eugene Yurtsev <eugene@langchain.dev>
This commit is contained in:
Christophe Bornet
2025-04-04 21:53:27 +02:00
committed by GitHub
parent 2491237473
commit f0159c7125
7 changed files with 46 additions and 38 deletions

View File

@@ -40,4 +40,4 @@ def test_all_imports() -> None:
def test_imports_for_specific_funcs() -> None:
"""Test that a few specific imports in more internal namespaces."""
# create_model implementation has been moved to langchain_core.utils.pydantic
from langchain_core.runnables.utils import create_model # noqa
from langchain_core.runnables.utils import create_model # noqa: F401

View File

@@ -444,7 +444,7 @@ def test_tree_is_constructed(parent_type: Literal["ls", "lc"]) -> None:
metadata={"some_foo": "some_bar"},
tags=["afoo"],
):
collected: dict[str, RunTree] = {} # noqa
collected: dict[str, RunTree] = {}
def collect_run(run: RunTree) -> None:
collected[str(run.id)] = run