style: fix some ruff noqa (#35321)

This commit is contained in:
Christophe Bornet
2026-02-19 19:19:30 +01:00
committed by GitHub
parent 59be7d734f
commit 6a6ef8caad
7 changed files with 27 additions and 29 deletions

View File

@@ -133,7 +133,7 @@ ignore-var-parameters = true # ignore missing documentation for *args and **kwa
"langchain_core/sys_info.py" = [ "T201",]
"tests/unit_tests/test_tools.py" = [ "ARG",]
"tests/**" = [ "D1", "PLR2004", "S", "SLF",]
"scripts/**" = [ "INP", "S",]
"scripts/**" = [ "INP", "S", "T201",]
[tool.coverage.run]
omit = [ "tests/*",]

View File

@@ -17,8 +17,8 @@ if __name__ == "__main__":
SourceFileLoader(module_name, file).load_module()
except Exception:
has_failure = True
print(file) # noqa: T201
print(file)
traceback.print_exc()
print() # noqa: T201
print()
sys.exit(1 if has_failure else 0)

View File

@@ -33,31 +33,31 @@ def main() -> int:
version_path = package_dir / "langchain_core" / "version.py"
if not pyproject_path.exists():
print(f"Error: {pyproject_path} not found") # noqa: T201
print(f"Error: {pyproject_path} not found")
return 1
if not version_path.exists():
print(f"Error: {version_path} not found") # noqa: T201
print(f"Error: {version_path} not found")
return 1
pyproject_version = get_pyproject_version(pyproject_path)
version_py_version = get_version_py_version(version_path)
if pyproject_version is None:
print("Error: Could not find version in pyproject.toml") # noqa: T201
print("Error: Could not find version in pyproject.toml")
return 1
if version_py_version is None:
print("Error: Could not find VERSION in langchain_core/version.py") # noqa: T201
print("Error: Could not find VERSION in langchain_core/version.py")
return 1
if pyproject_version != version_py_version:
print("Error: Version mismatch detected!") # noqa: T201
print(f" pyproject.toml: {pyproject_version}") # noqa: T201
print(f" langchain_core/version.py: {version_py_version}") # noqa: T201
print("Error: Version mismatch detected!")
print(f" pyproject.toml: {pyproject_version}")
print(f" langchain_core/version.py: {version_py_version}")
return 1
print(f"Version check passed: {pyproject_version}") # noqa: T201
print(f"Version check passed: {pyproject_version}")
return 0

View File

@@ -175,7 +175,8 @@ ignore-var-parameters = true # ignore missing documentation for *args and **kwa
]
"scripts/*" = [
"INP", # Scripts are not in a package
"INP", # Scripts are not in a package
"T201", # Scripts can print to the console
]
[tool.coverage.run]

View File

@@ -26,8 +26,8 @@ if __name__ == "__main__":
SourceFileLoader(module_name, file).load_module()
except Exception:
has_failure = True
print(file) # noqa: T201
print(file)
traceback.print_exc()
print() # noqa: T201
print()
sys.exit(1 if has_failure else 0)

View File

@@ -33,31 +33,31 @@ def main() -> int:
init_path = package_dir / "langchain" / "__init__.py"
if not pyproject_path.exists():
print(f"Error: {pyproject_path} not found") # noqa: T201
print(f"Error: {pyproject_path} not found")
return 1
if not init_path.exists():
print(f"Error: {init_path} not found") # noqa: T201
print(f"Error: {init_path} not found")
return 1
pyproject_version = get_pyproject_version(pyproject_path)
init_version = get_init_version(init_path)
if pyproject_version is None:
print("Error: Could not find version in pyproject.toml") # noqa: T201
print("Error: Could not find version in pyproject.toml")
return 1
if init_version is None:
print("Error: Could not find __version__ in langchain/__init__.py") # noqa: T201
print("Error: Could not find __version__ in langchain/__init__.py")
return 1
if pyproject_version != init_version:
print("Error: Version mismatch detected!") # noqa: T201
print(f" pyproject.toml: {pyproject_version}") # noqa: T201
print(f" langchain/__init__.py: {init_version}") # noqa: T201
print("Error: Version mismatch detected!")
print(f" pyproject.toml: {pyproject_version}")
print(f" langchain/__init__.py: {init_version}")
return 1
print(f"Version check passed: {pyproject_version}") # noqa: T201
print(f"Version check passed: {pyproject_version}")
return 0

View File

@@ -1,6 +1,8 @@
"""Integration tests for LangChain components."""
# ruff: noqa: E402
import importlib.util
import pytest
# Rewrite assert statements for test suite so that implementations can
@@ -19,13 +21,8 @@ modules = [
for module in modules:
pytest.register_assert_rewrite(f"langchain_tests.integration_tests.{module}")
_HAS_DEEPAGENTS = False
try:
import deepagents # noqa: F401
except ImportError:
_HAS_DEEPAGENTS = False
else:
_HAS_DEEPAGENTS = True
_HAS_DEEPAGENTS = importlib.util.find_spec("deepagents") is not None
if _HAS_DEEPAGENTS:
pytest.register_assert_rewrite("langchain_tests.integration_tests.sandboxes")
from langchain_tests.integration_tests.base_store import (