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

@@ -97,7 +97,6 @@ def _get_jinja2_variables_from_template(template: str) -> set[str]:
"Please install it with `pip install jinja2`."
)
raise ImportError(msg) from e
# noqa for insecure warning elsewhere
env = Environment() # noqa: S701
ast = env.parse(template)
return meta.find_undeclared_variables(ast)