standard-tests: Bump ruff version to 0.9 (#29230)

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Christophe Bornet 2025-01-22 01:23:01 +01:00 committed by GitHub
parent e4a78dfc2a
commit 2340b3154d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 30 deletions

View File

@ -137,7 +137,7 @@ class BaseStoreSyncTests(BaseStandardTests, Generic[V]):
self, kv_store: BaseStore[str, V], three_values: Tuple[V, V, V] self, kv_store: BaseStore[str, V], three_values: Tuple[V, V, V]
) -> None: ) -> None:
"""Test that we can yield keys from the store.""" """Test that we can yield keys from the store."""
foo, bar, buzz = three_values foo, bar, _buzz = three_values
key_value_pairs = [("foo", foo), ("bar", bar)] key_value_pairs = [("foo", foo), ("bar", bar)]
kv_store.mset(key_value_pairs) kv_store.mset(key_value_pairs)
@ -273,7 +273,7 @@ class BaseStoreAsyncTests(BaseStandardTests):
self, kv_store: BaseStore[str, V], three_values: Tuple[V, V, V] self, kv_store: BaseStore[str, V], three_values: Tuple[V, V, V]
) -> None: ) -> None:
"""Test that we can yield keys from the store.""" """Test that we can yield keys from the store."""
foo, bar, buzz = three_values foo, bar, _buzz = three_values
key_value_pairs = [("foo", foo), ("bar", bar)] key_value_pairs = [("foo", foo), ("bar", bar)]
await kv_store.amset(key_value_pairs) await kv_store.amset(key_value_pairs)

View File

@ -899,7 +899,10 @@ class ChatModelIntegrationTests(ChatModelTests):
assert isinstance(result, AIMessage) assert isinstance(result, AIMessage)
custom_model = self.chat_model_class( custom_model = self.chat_model_class(
**{**self.chat_model_params, "stop": ["you"]} **{
**self.chat_model_params,
"stop": ["you"],
}
) )
result = custom_model.invoke("hi") result = custom_model.invoke("hi")
assert isinstance(result, AIMessage) assert isinstance(result, AIMessage)

View File

@ -100,7 +100,10 @@ class ChatModelTests(BaseStandardTests):
def model(self) -> BaseChatModel: def model(self) -> BaseChatModel:
""":private:""" """:private:"""
return self.chat_model_class( return self.chat_model_class(
**{**self.standard_chat_model_params, **self.chat_model_params} **{
**self.standard_chat_model_params,
**self.chat_model_params,
}
) )
@pytest.fixture @pytest.fixture
@ -511,7 +514,10 @@ class ChatModelUnitTests(ChatModelTests):
2. The model accommodates standard parameters: https://python.langchain.com/docs/concepts/chat_models/#standard-parameters 2. The model accommodates standard parameters: https://python.langchain.com/docs/concepts/chat_models/#standard-parameters
""" # noqa: E501 """ # noqa: E501
model = self.chat_model_class( model = self.chat_model_class(
**{**self.standard_chat_model_params, **self.chat_model_params} **{
**self.standard_chat_model_params,
**self.chat_model_params,
}
) )
assert model is not None assert model is not None
@ -673,7 +679,7 @@ class ChatModelUnitTests(ChatModelTests):
if not self.chat_model_class.is_lc_serializable(): if not self.chat_model_class.is_lc_serializable():
pytest.skip("Model is not serializable.") pytest.skip("Model is not serializable.")
else: else:
env_params, model_params, expected_attrs = self.init_from_env_params env_params, _model_params, _expected_attrs = self.init_from_env_params
with mock.patch.dict(os.environ, env_params): with mock.patch.dict(os.environ, env_params):
ser = dumpd(model) ser = dumpd(model)
assert ser == snapshot(name="serialized") assert ser == snapshot(name="serialized")

View File

@ -1,4 +1,4 @@
# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. # This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand.
[[package]] [[package]]
name = "annotated-types" name = "annotated-types"
@ -923,29 +923,29 @@ requests = ">=2.0.1,<3.0.0"
[[package]] [[package]]
name = "ruff" name = "ruff"
version = "0.8.2" version = "0.9.2"
description = "An extremely fast Python linter and code formatter, written in Rust." description = "An extremely fast Python linter and code formatter, written in Rust."
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "ruff-0.8.2-py3-none-linux_armv6l.whl", hash = "sha256:c49ab4da37e7c457105aadfd2725e24305ff9bc908487a9bf8d548c6dad8bb3d"}, {file = "ruff-0.9.2-py3-none-linux_armv6l.whl", hash = "sha256:80605a039ba1454d002b32139e4970becf84b5fee3a3c3bf1c2af6f61a784347"},
{file = "ruff-0.8.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:ec016beb69ac16be416c435828be702ee694c0d722505f9c1f35e1b9c0cc1bf5"}, {file = "ruff-0.9.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b9aab82bb20afd5f596527045c01e6ae25a718ff1784cb92947bff1f83068b00"},
{file = "ruff-0.8.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f05cdf8d050b30e2ba55c9b09330b51f9f97d36d4673213679b965d25a785f3c"}, {file = "ruff-0.9.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:fbd337bac1cfa96be615f6efcd4bc4d077edbc127ef30e2b8ba2a27e18c054d4"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:60f578c11feb1d3d257b2fb043ddb47501ab4816e7e221fbb0077f0d5d4e7b6f"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82b35259b0cbf8daa22a498018e300b9bb0174c2bbb7bcba593935158a78054d"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cbd5cf9b0ae8f30eebc7b360171bd50f59ab29d39f06a670b3e4501a36ba5897"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8b6a9701d1e371bf41dca22015c3f89769da7576884d2add7317ec1ec8cb9c3c"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b402ddee3d777683de60ff76da801fa7e5e8a71038f57ee53e903afbcefdaa58"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:9cc53e68b3c5ae41e8faf83a3b89f4a5d7b2cb666dff4b366bb86ed2a85b481f"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:705832cd7d85605cb7858d8a13d75993c8f3ef1397b0831289109e953d833d29"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8efd9da7a1ee314b910da155ca7e8953094a7c10d0c0a39bfde3fcfd2a015684"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:32096b41aaf7a5cc095fa45b4167b890e4c8d3fd217603f3634c92a541de7248"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3292c5a22ea9a5f9a185e2d131dc7f98f8534a32fb6d2ee7b9944569239c648d"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e769083da9439508833cfc7c23e351e1809e67f47c50248250ce1ac52c21fb93"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:1a605fdcf6e8b2d39f9436d343d1f0ff70c365a1e681546de0104bef81ce88df"},
{file = "ruff-0.8.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5fe716592ae8a376c2673fdfc1f5c0c193a6d0411f90a496863c99cd9e2ae25d"}, {file = "ruff-0.9.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c547f7f256aa366834829a08375c297fa63386cbe5f1459efaf174086b564247"},
{file = "ruff-0.8.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:81c148825277e737493242b44c5388a300584d73d5774defa9245aaef55448b0"}, {file = "ruff-0.9.2-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d18bba3d3353ed916e882521bc3e0af403949dbada344c20c16ea78f47af965e"},
{file = "ruff-0.8.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:d261d7850c8367704874847d95febc698a950bf061c9475d4a8b7689adc4f7fa"}, {file = "ruff-0.9.2-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:b338edc4610142355ccf6b87bd356729b62bf1bc152a2fad5b0c7dc04af77bfe"},
{file = "ruff-0.8.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:1ca4e3a87496dc07d2427b7dd7ffa88a1e597c28dad65ae6433ecb9f2e4f022f"}, {file = "ruff-0.9.2-py3-none-musllinux_1_2_i686.whl", hash = "sha256:492a5e44ad9b22a0ea98cf72e40305cbdaf27fac0d927f8bc9e1df316dcc96eb"},
{file = "ruff-0.8.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:729850feed82ef2440aa27946ab39c18cb4a8889c1128a6d589ffa028ddcfc22"}, {file = "ruff-0.9.2-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:af1e9e9fe7b1f767264d26b1075ac4ad831c7db976911fa362d09b2d0356426a"},
{file = "ruff-0.8.2-py3-none-win32.whl", hash = "sha256:ac42caaa0411d6a7d9594363294416e0e48fc1279e1b0e948391695db2b3d5b1"}, {file = "ruff-0.9.2-py3-none-win32.whl", hash = "sha256:71cbe22e178c5da20e1514e1e01029c73dc09288a8028a5d3446e6bba87a5145"},
{file = "ruff-0.8.2-py3-none-win_amd64.whl", hash = "sha256:2aae99ec70abf43372612a838d97bfe77d45146254568d94926e8ed5bbb409ea"}, {file = "ruff-0.9.2-py3-none-win_amd64.whl", hash = "sha256:c5e1d6abc798419cf46eed03f54f2e0c3adb1ad4b801119dedf23fcaf69b55b5"},
{file = "ruff-0.8.2-py3-none-win_arm64.whl", hash = "sha256:fb88e2a506b70cfbc2de6fae6681c4f944f7dd5f2fe87233a7233d888bad73e8"}, {file = "ruff-0.9.2-py3-none-win_arm64.whl", hash = "sha256:a1b63fa24149918f8b37cef2ee6fff81f24f0d74b6f0bdc37bc3e1f2143e41c6"},
{file = "ruff-0.8.2.tar.gz", hash = "sha256:b84f4f414dda8ac7f75075c1fa0b905ac0ff25361f42e6d5da681a465e0f78e5"}, {file = "ruff-0.9.2.tar.gz", hash = "sha256:b5eceb334d55fae5f316f783437392642ae18e16dcf4f1858d55d3c2a0f8f5d0"},
] ]
[[package]] [[package]]
@ -1060,4 +1060,4 @@ zstd = ["zstandard (>=0.18.0)"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = ">=3.9,<4.0" python-versions = ">=3.9,<4.0"
content-hash = "c7788100e716b6bb0a93ff547aaa451f70b435b0c0405c7a06581ddb7fac6f20" content-hash = "10f4d72f89f772f9c35b1fadf419e09f26fc52ef720e1e444d862dbb5dc89e04"

View File

@ -34,6 +34,9 @@ python = "<3.12"
version = ">=1.26.2,<3" version = ">=1.26.2,<3"
python = ">=3.12" python = ">=3.12"
[tool.ruff]
target-version = "py39"
[tool.ruff.lint] [tool.ruff.lint]
select = ["E", "F", "I", "T201"] select = ["E", "F", "I", "T201"]
@ -69,7 +72,7 @@ optional = true
codespell = "^2.2.0" codespell = "^2.2.0"
[tool.poetry.group.lint.dependencies] [tool.poetry.group.lint.dependencies]
ruff = ">=0.5" ruff = "^0.9.2"
[tool.poetry.group.typing.dependencies] [tool.poetry.group.typing.dependencies]
mypy = "^1" mypy = "^1"

View File

@ -9,8 +9,7 @@ from langchain_tests.unit_tests import ToolsUnitTests
class ParrotMultiplyTool(BaseTool): # type: ignore class ParrotMultiplyTool(BaseTool): # type: ignore
name: str = "ParrotMultiplyTool" name: str = "ParrotMultiplyTool"
description: str = ( description: str = (
"Multiply two numbers like a parrot. Parrots always add " "Multiply two numbers like a parrot. Parrots always add eighty for their matey."
"eighty for their matey."
) )
def _run(self, a: int, b: int) -> int: def _run(self, a: int, b: int) -> int: