fix: replace bare except with except Exception in analysis.py (#1502)

Bare except clauses catch SystemExit and KeyboardInterrupt which
prevents clean process termination. Use except Exception per PEP 8.

Co-authored-by: Srikanth Patchava <srpatcha@users.noreply.github.com>
This commit is contained in:
Srikanth Patchava
2026-05-04 19:02:58 -07:00
committed by GitHub
parent e2f5b958b1
commit 769741b9e2
@@ -483,7 +483,7 @@ def _calc_single_psi(args):
# Bin based on non-NaN data (10 bins) # Bin based on non-NaN data (10 bins)
try: try:
bins = pd.qcut(train_nonan, q=10, duplicates='drop', retbins=True)[1] bins = pd.qcut(train_nonan, q=10, duplicates='drop', retbins=True)[1]
except: except Exception:
bins = pd.cut(train_nonan, bins=10, retbins=True)[1] bins = pd.cut(train_nonan, bins=10, retbins=True)[1]
# Calculate proportion of each bin (including NaN bin) # Calculate proportion of each bin (including NaN bin)
@@ -996,7 +996,7 @@ def export_cleaning_report(filepath: str, steps: list,
try: try:
wb = load_workbook(filepath) wb = load_workbook(filepath)
except: except Exception:
wb = Workbook() wb = Workbook()
wb.remove(wb.active) wb.remove(wb.active)