Skip to content

Commit aed7a41

Browse files
authored
fix: remove redundant gc.collect() and combine split f-strings (#1074)
1 parent 6986c46 commit aed7a41

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

examples/retool/tool_sandbox.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def get_memory_usage() -> float:
4747
def cleanup_memory():
4848
"""Force garbage collection to free memory"""
4949
gc.collect()
50-
if hasattr(gc, "collect"):
51-
gc.collect()
5250

5351

5452
def aggressive_cleanup_memory():
@@ -282,11 +280,11 @@ async def execute_code(self, code: str) -> str:
282280
if process.returncode == 0:
283281
result = stdout.strip()
284282
else:
285-
result = f"Error: Process exited with code " f"{process.returncode}\n{stderr}"
283+
result = f"Error: Process exited with code {process.returncode}\n{stderr}"
286284

287285
except subprocess.TimeoutExpired:
288286
process.kill()
289-
result = f"Error: Code execution timed out after " f"{self.timeout} seconds"
287+
result = f"Error: Code execution timed out after {self.timeout} seconds"
290288

291289
except Exception as e:
292290
result = f"Error: Failed to execute code: {str(e)}"

0 commit comments

Comments
 (0)