Skip to content

Commit 672eeb1

Browse files
committed
fix: lint
1 parent 0d27435 commit 672eeb1

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

libs/sandbox-py/langchain_sandbox/__init__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,4 @@
66
SyncPyodideSandbox,
77
)
88

9-
__all__ = [
10-
"PyodideSandbox",
11-
"PyodideSandboxTool",
12-
"SyncPyodideSandbox"
13-
]
9+
__all__ = ["PyodideSandbox", "PyodideSandboxTool", "SyncPyodideSandbox"]

libs/sandbox-py/langchain_sandbox/pyodide.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ def get_attached_files(self) -> list[str]:
355355
List of file paths that will be available in the sandbox filesystem
356356
"""
357357
return [
358-
op.path
359-
for op in self._filesystem_operations
360-
if op.operation == "write"
358+
op.path for op in self._filesystem_operations if op.operation == "write"
361359
]
362360

363361
def clear_filesystem_operations(self) -> None:
@@ -421,9 +419,7 @@ def _build_command(
421419
if self._filesystem_operations or self.enable_filesystem:
422420
if self._filesystem_operations:
423421
fs_ops = [op.to_dict() for op in self._filesystem_operations]
424-
fs_json = json.dumps(
425-
fs_ops, ensure_ascii=True, separators=(",", ":")
426-
)
422+
fs_json = json.dumps(fs_ops, ensure_ascii=True, separators=(",", ":"))
427423
cmd.extend(["-x", fs_json])
428424
logger.debug("Filesystem enabled with %d operations", len(fs_ops))
429425
else:
@@ -983,20 +979,14 @@ def as_structured_tool(self) -> StructuredTool:
983979
self._structured_tool = StructuredTool.from_function(
984980
name=self.name,
985981
description=self._build_description(),
986-
func=(
987-
self._run_sync
988-
if not self.stateful
989-
else self._run_stateful_sync
990-
),
982+
func=(self._run_sync if not self.stateful else self._run_stateful_sync),
991983
args_schema=self.args_schema,
992984
)
993985
return self._structured_tool
994986

995987
def _run_sync(self, code: str) -> str:
996988
"""Synchronous execution function for non-stateful mode."""
997-
result = self._sync_sandbox.execute(
998-
code, timeout_seconds=self.timeout_seconds
999-
)
989+
result = self._sync_sandbox.execute(code, timeout_seconds=self.timeout_seconds)
1000990

1001991
if result.status == "error":
1002992
error_msg = (
@@ -1025,8 +1015,7 @@ def _run_stateful_sync(
10251015
actual_keys = set(state) if isinstance(state, dict) else set(state.__dict__)
10261016
if missing_keys := required_keys - actual_keys:
10271017
error_msg = (
1028-
"Input state is missing "
1029-
f"the following required keys: {missing_keys}"
1018+
f"Input state is missing the following required keys: {missing_keys}"
10301019
)
10311020
raise ValueError(error_msg)
10321021

libs/sandbox-py/tests/unit_tests/test_pyodide_sandbox.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def get_default_sync_sandbox(stateful: bool = False) -> SyncPyodideSandbox:
5656
allow_ffi=False,
5757
)
5858

59+
5960
def test_pyodide_sandbox_tool() -> None:
6061
"""Test synchronous invocation of PyodideSandboxTool."""
6162
tool = PyodideSandboxTool(

0 commit comments

Comments
 (0)