Skip to content

Commit 070388c

Browse files
committed
chore(langchain): fix some no-return-any mypy violations
1 parent 73ba156 commit 070388c

File tree

5 files changed

+238
-145
lines changed

5 files changed

+238
-145
lines changed

libs/langchain_v1/langchain/agents/factory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ def _resolve_schema(schemas: set[type], schema_name: str, omit_flag: str | None
308308
if not should_omit:
309309
all_annotations[field_name] = field_type
310310

311-
return TypedDict(schema_name, all_annotations) # type: ignore[operator]
311+
return cast("type", TypedDict(schema_name, all_annotations)) # type: ignore[operator]
312312

313313

314314
def _extract_metadata(type_: type) -> list:
@@ -347,7 +347,7 @@ def _get_can_jump_to(middleware: AgentMiddleware[Any, Any], hook_name: str) -> l
347347
and sync_method is not base_sync_method
348348
and hasattr(sync_method, "__can_jump_to__")
349349
):
350-
return sync_method.__can_jump_to__
350+
return cast("list[JumpTo]", sync_method.__can_jump_to__)
351351

352352
# Try async method - only if it's overridden from base class
353353
async_method = getattr(middleware.__class__, f"a{hook_name}", None)
@@ -356,7 +356,7 @@ def _get_can_jump_to(middleware: AgentMiddleware[Any, Any], hook_name: str) -> l
356356
and async_method is not base_async_method
357357
and hasattr(async_method, "__can_jump_to__")
358358
):
359-
return async_method.__can_jump_to__
359+
return cast("list[JumpTo]", async_method.__can_jump_to__)
360360

361361
return []
362362

libs/langchain_v1/langchain/agents/middleware/shell_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def _run_shell_tool(
605605
payload: dict[str, Any],
606606
*,
607607
tool_call_id: str | None,
608-
) -> Any:
608+
) -> ToolMessage | str:
609609
session = resources.session
610610

611611
if payload.get("restart"):

0 commit comments

Comments
 (0)