mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 18:50:33 +00:00
groq[patch]: ruff fixes and rules (#31904)
* bump ruff deps * add more thorough ruff rules * fix said rules
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
"""A fake callback handler for testing purposes."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from itertools import chain
|
||||
from typing import Any, Optional, Union
|
||||
from uuid import UUID
|
||||
@@ -257,7 +259,7 @@ class FakeCallbackHandler(BaseCallbackHandler, BaseFakeCallbackHandlerMixin):
|
||||
self.on_retriever_error_common()
|
||||
|
||||
# Overriding since BaseModel has __deepcopy__ method as well
|
||||
def __deepcopy__(self, memo: dict) -> "FakeCallbackHandler": # type: ignore
|
||||
def __deepcopy__(self, memo: dict) -> FakeCallbackHandler: # type: ignore[override]
|
||||
return self
|
||||
|
||||
|
||||
@@ -392,5 +394,5 @@ class FakeAsyncCallbackHandler(AsyncCallbackHandler, BaseFakeCallbackHandlerMixi
|
||||
self.on_text_common()
|
||||
|
||||
# Overriding since BaseModel has __deepcopy__ method as well
|
||||
def __deepcopy__(self, memo: dict) -> "FakeAsyncCallbackHandler": # type: ignore
|
||||
def __deepcopy__(self, memo: dict) -> FakeAsyncCallbackHandler: # type: ignore[override]
|
||||
return self
|
||||
|
||||
@@ -244,7 +244,7 @@ def test_chat_groq_invalid_streaming_params() -> None:
|
||||
|
||||
|
||||
def test_chat_groq_secret() -> None:
|
||||
"""Test that secret is not printed"""
|
||||
"""Test that secret is not printed."""
|
||||
secret = "secretKey" # noqa: S105
|
||||
not_secret = "safe" # noqa: S105
|
||||
llm = ChatGroq(model="foo", api_key=secret, model_kwargs={"not_secret": not_secret}) # type: ignore[call-arg, arg-type]
|
||||
@@ -255,7 +255,7 @@ def test_chat_groq_secret() -> None:
|
||||
|
||||
@pytest.mark.filterwarnings("ignore:The function `loads` is in beta")
|
||||
def test_groq_serialization() -> None:
|
||||
"""Test that ChatGroq can be successfully serialized and deserialized"""
|
||||
"""Test that ChatGroq can be successfully serialized and deserialized."""
|
||||
api_key1 = "top secret"
|
||||
api_key2 = "topest secret"
|
||||
llm = ChatGroq(model="foo", api_key=api_key1, temperature=0.5) # type: ignore[call-arg, arg-type]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Standard LangChain interface tests"""
|
||||
"""Standard LangChain interface tests."""
|
||||
|
||||
from langchain_core.language_models import BaseChatModel
|
||||
from langchain_tests.unit_tests.chat_models import (
|
||||
|
||||
Reference in New Issue
Block a user