Skip to content

Commit 723031d

Browse files
cbornetErick Friis
andauthored
community: Bump ruff version to 0.9 (#29206)
Co-authored-by: Erick Friis <[email protected]>
1 parent 30f6c9f commit 723031d

File tree

166 files changed

+5417
-532
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+5417
-532
lines changed

libs/community/langchain_community/agent_toolkits/nla/tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def from_open_api_endpoint_chain(
3030
The API endpoint tool.
3131
"""
3232
expanded_name = (
33-
f'{api_title.replace(" ", "_")}.{chain.api_operation.operation_id}'
33+
f"{api_title.replace(' ', '_')}.{chain.api_operation.operation_id}"
3434
)
3535
description = (
3636
f"I'm an AI from {api_title}. Instruct what you want,"

libs/community/langchain_community/callbacks/fiddler_callback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def __init__(
100100

101101
if self.project not in self.fiddler_client.get_project_names():
102102
print( # noqa: T201
103-
f"adding project {self.project}." "This only has to be done once."
103+
f"adding project {self.project}.This only has to be done once."
104104
)
105105
try:
106106
self.fiddler_client.add_project(self.project)

libs/community/langchain_community/callbacks/manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def get_openai_callback() -> Generator[OpenAICallbackHandler, None, None]:
6161

6262

6363
@contextmanager
64-
def get_bedrock_anthropic_callback() -> (
65-
Generator[BedrockAnthropicTokenUsageCallbackHandler, None, None]
66-
):
64+
def get_bedrock_anthropic_callback() -> Generator[
65+
BedrockAnthropicTokenUsageCallbackHandler, None, None
66+
]:
6767
"""Get the Bedrock anthropic callback handler in a context manager.
6868
which conveniently exposes token and cost information.
6969

libs/community/langchain_community/callbacks/streamlit/streamlit_callback_handler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,9 @@ def on_agent_action(
211211
def complete(self, final_label: Optional[str] = None) -> None:
212212
"""Finish the thought."""
213213
if final_label is None and self._state == LLMThoughtState.RUNNING_TOOL:
214-
assert (
215-
self._last_tool is not None
216-
), "_last_tool should never be null when _state == RUNNING_TOOL"
214+
assert self._last_tool is not None, (
215+
"_last_tool should never be null when _state == RUNNING_TOOL"
216+
)
217217
final_label = self._labeler.get_tool_label(
218218
self._last_tool, is_complete=True
219219
)

libs/community/langchain_community/chains/pebblo_retrieval/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ async def amake_request(
467467
logger.warning(f"Pebblo Server: Error {response.status}")
468468
elif response.status >= HTTPStatus.BAD_REQUEST:
469469
logger.warning(
470-
f"Pebblo received an invalid payload: " f"{response.text}"
470+
f"Pebblo received an invalid payload: {response.text}"
471471
)
472472
elif response.status != HTTPStatus.OK:
473473
logger.warning(

libs/community/langchain_community/chat_loaders/facebook_messenger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def lazy_load(self) -> Iterator[ChatSession]:
3737
if "content" not in m:
3838
logger.info(
3939
f"""Skipping Message No.
40-
{index+1} as no content is present in the message"""
40+
{index + 1} as no content is present in the message"""
4141
)
4242
continue
4343
messages.append(

libs/community/langchain_community/chat_message_histories/neo4j.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def messages(self) -> List[BaseMessage]:
8787
query = (
8888
f"MATCH (s:`{self._node_label}`)-[:LAST_MESSAGE]->(last_message) "
8989
"WHERE s.id = $session_id MATCH p=(last_message)<-[:NEXT*0.."
90-
f"{self._window*2}]-() WITH p, length(p) AS length "
90+
f"{self._window * 2}]-() WITH p, length(p) AS length "
9191
"ORDER BY length DESC LIMIT 1 UNWIND reverse(nodes(p)) AS node "
9292
"RETURN {data:{content: node.content}, type:node.type} AS result"
9393
)

libs/community/langchain_community/chat_message_histories/sql.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,9 @@ def __init__(
177177
engine_args: Additional configuration for creating database engines.
178178
async_mode: Whether it is an asynchronous connection.
179179
"""
180-
assert not (
181-
connection_string and connection
182-
), "connection_string and connection are mutually exclusive"
180+
assert not (connection_string and connection), (
181+
"connection_string and connection are mutually exclusive"
182+
)
183183
if connection_string:
184184
global _warned_once_already
185185
if not _warned_once_already:

libs/community/langchain_community/chat_models/bedrock.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def _format_anthropic_messages(
110110

111111
if not isinstance(message.content, str):
112112
# parse as dict
113-
assert isinstance(
114-
message.content, list
115-
), "Anthropic message content must be str or list of dicts"
113+
assert isinstance(message.content, list), (
114+
"Anthropic message content must be str or list of dicts"
115+
)
116116

117117
# populate content
118118
content = []

libs/community/langchain_community/chat_models/deepinfra.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,8 +468,7 @@ def _handle_status(self, code: int, text: Any) -> None:
468468
raise ValueError(f"DeepInfra received an invalid payload: {text}")
469469
elif code != 200:
470470
raise Exception(
471-
f"DeepInfra returned an unexpected response with status "
472-
f"{code}: {text}"
471+
f"DeepInfra returned an unexpected response with status {code}: {text}"
473472
)
474473

475474
def _url(self) -> str:

0 commit comments

Comments
 (0)