Skip to content

Commit 26e2b39

Browse files
authored
Merge pull request #91 from Ibrahim-3d/feat/53-bare-except-audit
[SECURITY] Replace 14 bare except blocks in pt_hub.py - closes #53
2 parents a3a733b + 1d330c6 commit 26e2b39

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

app/pt_hub.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4247,7 +4247,7 @@ def _create_llm_research_tab(self):
42474247
font=("TkDefaultFont", 10),
42484248
anchor="center",
42494249
).pack(expand=True, fill="both", padx=20, pady=20)
4250-
except:
4250+
except Exception:
42514251
pass
42524252
print(f"Error creating LLM Research tab: {e}")
42534253
import traceback
@@ -4288,7 +4288,7 @@ def _create_holdings_management_tab(self):
42884288
font=("TkDefaultFont", 10),
42894289
anchor="center",
42904290
).pack(expand=True, fill="both", padx=20, pady=20)
4291-
except:
4291+
except Exception:
42924292
pass
42934293
print(f"Error creating Holdings Management tab: {e}")
42944294
import traceback
@@ -4329,7 +4329,7 @@ def _create_portfolio_analytics_tab(self):
43294329
font=("TkDefaultFont", 10),
43304330
anchor="center",
43314331
).pack(expand=True, fill="both", padx=20, pady=20)
4332-
except:
4332+
except Exception:
43334333
pass
43344334
print(f"Error creating Portfolio Analytics tab: {e}")
43354335
import traceback
@@ -4370,7 +4370,7 @@ def _create_advanced_order_tab(self):
43704370
font=("TkDefaultFont", 10),
43714371
anchor="center",
43724372
).pack(expand=True, fill="both", padx=20, pady=20)
4373-
except:
4373+
except Exception:
43744374
pass
43754375
print(f"Error creating Advanced Order Types tab: {e}")
43764376
import traceback
@@ -4411,7 +4411,7 @@ def _create_market_data_tab(self):
44114411
font=("TkDefaultFont", 10),
44124412
anchor="center",
44134413
).pack(expand=True, fill="both", padx=20, pady=20)
4414-
except:
4414+
except Exception:
44154415
pass
44164416
print(f"Error creating Real-time Market Data tab: {e}")
44174417
import traceback
@@ -4455,7 +4455,7 @@ def _create_portfolio_optimization_tab(self):
44554455
font=("TkDefaultFont", 10),
44564456
anchor="center",
44574457
).pack(expand=True, fill="both", padx=20, pady=20)
4458-
except:
4458+
except Exception:
44594459
pass
44604460
print(f"Error creating Portfolio Optimization tab: {e}")
44614461
import traceback
@@ -4496,7 +4496,7 @@ def _create_backtesting_tab(self):
44964496
font=("TkDefaultFont", 10),
44974497
anchor="center",
44984498
).pack(expand=True, fill="both", padx=20, pady=20)
4499-
except:
4499+
except Exception:
45004500
pass
45014501
print(f"Error creating Backtesting Framework tab: {e}")
45024502
import traceback
@@ -4541,7 +4541,7 @@ def _create_performance_attribution_tab(self):
45414541
font=("TkDefaultFont", 10),
45424542
anchor="center",
45434543
).pack(expand=True, fill="both", padx=20, pady=20)
4544-
except:
4544+
except Exception:
45454545
pass
45464546
print(f"Error creating Performance Attribution tab: {e}")
45474547
import traceback
@@ -4582,7 +4582,7 @@ def _create_institutional_trading_tab(self):
45824582
font=("TkDefaultFont", 10),
45834583
anchor="center",
45844584
).pack(expand=True, fill="both", padx=20, pady=20)
4585-
except:
4585+
except Exception:
45864586
pass
45874587
print(f"Error creating Institutional Trading tab: {e}")
45884588
import traceback
@@ -5494,7 +5494,7 @@ def start_trainer_for_selected_coin(self) -> None:
54945494
print(f"DEBUG: Process output: {stdout}")
54955495
if stderr:
54965496
print(f"DEBUG: Process stderr: {stderr}")
5497-
except:
5497+
except (TimeoutError, OSError):
54985498
pass
54995499
return # Don't register a failed process
55005500

@@ -5543,7 +5543,7 @@ def _monitor_trainer_process(self, coin: str) -> None:
55435543
print(
55445544
f"DEBUG: Final output from {coin}: {remaining_output}"
55455545
)
5546-
except:
5546+
except (OSError, AttributeError):
55475547
pass
55485548
else:
55495549
# Process still running, check again in 2 seconds
@@ -5626,7 +5626,7 @@ def _create_crypto_icon_grid(
56265626
# Ensure we get 3 coins in normal view, 4-5 in fullscreen
56275627
if max_cols < 3:
56285628
max_cols = 3
5629-
except:
5629+
except Exception:
56305630
max_cols = 3 # Default to 3 for better wrapping
56315631

56325632
row = 0
@@ -5715,7 +5715,7 @@ def on_enter(event):
57155715
frame.configure(relief="raised", bd=3)
57165716
else:
57175717
frame.configure(relief="raised", bd=3)
5718-
except:
5718+
except Exception:
57195719
frame.configure(relief="raised", bd=3)
57205720

57215721
def on_leave(event):
@@ -5852,7 +5852,7 @@ def on_coin_click(event=None):
58525852
"Training Error",
58535853
f"Failed {action} training for {coin_name}: {e}",
58545854
)
5855-
except:
5855+
except Exception:
58565856
pass
58575857

58585858
return on_coin_click

0 commit comments

Comments
 (0)