Skip to content

Commit ff03f19

Browse files
Address code review feedback - move imports and clarify lambda closures
Co-authored-by: codingwithnsh <138281862+codingwithnsh@users.noreply.github.com>
1 parent 2856ee1 commit ff03f19

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

sandbox_dashboard.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,9 +473,10 @@ def select_template(tid=template_id, frame=btn_frame):
473473
update_description()
474474
update_limits()
475475

476-
btn_frame.bind('<Button-1>', lambda e, tid=template_id, frame=btn_frame: select_template(tid, frame))
476+
# Bind click events - using default arguments to properly capture loop variables
477+
btn_frame.bind('<Button-1>', lambda e, t=template_id, f=btn_frame: select_template(t, f))
477478
for child in btn_frame.winfo_children():
478-
child.bind('<Button-1>', lambda e, tid=template_id, frame=btn_frame: select_template(tid, frame))
479+
child.bind('<Button-1>', lambda e, t=template_id, f=btn_frame: select_template(t, f))
479480

480481
template_buttons.append(btn_frame)
481482

sandbox_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import threading
1111
import time
1212
import uuid
13+
import traceback
1314
from pathlib import Path
1415
from datetime import datetime
1516
import psutil
@@ -70,7 +71,6 @@ def create(self):
7071
return True
7172
except (OSError, PermissionError) as e:
7273
print(f"Error creating sandbox: {e}")
73-
import traceback
7474
traceback.print_exc()
7575
return False
7676

@@ -323,7 +323,6 @@ def create_sandbox(self, name, sandbox_type="general", config=None):
323323
return sandbox
324324
except Exception as e:
325325
print(f"Error creating sandbox: {e}")
326-
import traceback
327326
traceback.print_exc()
328327
return None
329328

0 commit comments

Comments
 (0)