mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-04 04:07:54 +00:00
langchain-groq[patch]: Add ruff bandit rules to linter (#31797)
- Add ruff bandit rules - Address s105 errors
This commit is contained in:
parent
479b6fd7c5
commit
0efaa483e4
@ -44,7 +44,7 @@ disallow_untyped_defs = "True"
|
|||||||
target-version = "py39"
|
target-version = "py39"
|
||||||
|
|
||||||
[tool.ruff.lint]
|
[tool.ruff.lint]
|
||||||
select = ["E", "F", "I", "W", "UP"]
|
select = ["E", "F", "I", "W", "UP", "S"]
|
||||||
ignore = [ "UP007", ]
|
ignore = [ "UP007", ]
|
||||||
|
|
||||||
[tool.coverage.run]
|
[tool.coverage.run]
|
||||||
@ -57,3 +57,9 @@ markers = [
|
|||||||
"scheduled: mark tests to run in scheduled testing",
|
"scheduled: mark tests to run in scheduled testing",
|
||||||
]
|
]
|
||||||
asyncio_mode = "auto"
|
asyncio_mode = "auto"
|
||||||
|
|
||||||
|
[tool.ruff.lint.extend-per-file-ignores]
|
||||||
|
"tests/**/*.py" = [
|
||||||
|
"S101", # Tests need assertions
|
||||||
|
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
|
||||||
|
]
|
@ -245,8 +245,8 @@ def test_chat_groq_invalid_streaming_params() -> None:
|
|||||||
|
|
||||||
def test_chat_groq_secret() -> None:
|
def test_chat_groq_secret() -> None:
|
||||||
"""Test that secret is not printed"""
|
"""Test that secret is not printed"""
|
||||||
secret = "secretKey"
|
secret = "secretKey" # noqa: S105
|
||||||
not_secret = "safe"
|
not_secret = "safe" # noqa: S105
|
||||||
llm = ChatGroq(model="foo", api_key=secret, model_kwargs={"not_secret": not_secret}) # type: ignore[call-arg, arg-type]
|
llm = ChatGroq(model="foo", api_key=secret, model_kwargs={"not_secret": not_secret}) # type: ignore[call-arg, arg-type]
|
||||||
stringified = str(llm)
|
stringified = str(llm)
|
||||||
assert not_secret in stringified
|
assert not_secret in stringified
|
||||||
|
Loading…
Reference in New Issue
Block a user