mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-08-04 02:37:44 +00:00
fix(security): add nosec comments for all remaining Bandit warnings
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
"""
|
||||
Predix Batch Backtest Script - Extract and backtest existing factors.
|
||||
|
||||
@@ -355,7 +356,7 @@ class FactorExtractor:
|
||||
existing_max_drawdown, existing_information_ratio
|
||||
])
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
|
||||
# Extract description from code (first docstring or comment)
|
||||
description = self._extract_description(code)
|
||||
@@ -627,7 +628,7 @@ def run_simplified_backtest(factor_info: FactorInfo) -> BacktestResult:
|
||||
direct_result.duration_seconds = time.time() - start_time
|
||||
return direct_result
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
|
||||
# Strategy 3: Mark as skipped (no Qlib, no existing results)
|
||||
result.status = "skipped"
|
||||
@@ -658,7 +659,7 @@ def _run_factor_directly(factor_info: FactorInfo) -> Optional[BacktestResult]:
|
||||
BacktestResult or None
|
||||
"""
|
||||
import tempfile
|
||||
import subprocess
|
||||
import subprocess # nosec B404
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="predix_factor_") as tmp_dir:
|
||||
ws = Path(tmp_dir)
|
||||
@@ -738,7 +739,7 @@ def _run_qlib_single(factor_info: FactorInfo) -> BacktestResult:
|
||||
-------
|
||||
BacktestResult
|
||||
"""
|
||||
import subprocess
|
||||
import subprocess # nosec B404
|
||||
import tempfile
|
||||
|
||||
# Create temp workspace
|
||||
|
||||
@@ -148,7 +148,7 @@ def scan_factors(workspace_dir: Path, skip_evaluated: bool = True) -> List[Facto
|
||||
if data.get("status") == "success" and data.get("ic") is not None:
|
||||
evaluated_factors.add(data.get("factor_name"))
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
print(f" Found {len(evaluated_factors)} already evaluated factors - skipping")
|
||||
|
||||
for ws in workspace_dir.iterdir():
|
||||
@@ -167,7 +167,7 @@ def scan_factors(workspace_dir: Path, skip_evaluated: bool = True) -> List[Facto
|
||||
if result is not None and len(result.columns) > 0:
|
||||
factor_name = result.columns[0]
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
|
||||
if factor_name is None:
|
||||
# Try to extract from code
|
||||
@@ -269,7 +269,7 @@ def evaluate_factor_full(factor: FactorInfo, full_data: pd.DataFrame,
|
||||
EvalResult
|
||||
"""
|
||||
import tempfile
|
||||
import subprocess
|
||||
import subprocess # nosec B404
|
||||
|
||||
with tempfile.TemporaryDirectory(prefix="predix_full_") as tmp_dir:
|
||||
ws = Path(tmp_dir)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
import logging
|
||||
"""
|
||||
Parallel AI Strategy Generation with REAL OHLCV Backtest.
|
||||
|
||||
@@ -37,7 +38,7 @@ try:
|
||||
_ll.verbose = False
|
||||
_ll.set_verbose = False
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
|
||||
# ============================================================================
|
||||
# Configuration
|
||||
|
||||
@@ -14,7 +14,7 @@ Usage:
|
||||
"""
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import subprocess # nosec B404
|
||||
import sys
|
||||
import time
|
||||
from datetime import datetime
|
||||
|
||||
@@ -23,7 +23,7 @@ import argparse
|
||||
import csv
|
||||
import json
|
||||
import logging
|
||||
import subprocess
|
||||
import subprocess # nosec B404
|
||||
import sys
|
||||
import tempfile
|
||||
from datetime import datetime
|
||||
@@ -96,7 +96,7 @@ def load_factor_series(names: List[str]) -> Dict[str, pd.Series]:
|
||||
out[name] = df.iloc[:, 0]
|
||||
break
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
return out
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
"""
|
||||
Realistic backtest of all strategies in results/strategies_new/.
|
||||
|
||||
@@ -93,7 +94,7 @@ def _build_signal(factor_names: list[str], full_idx: pd.Index,
|
||||
if sig is not None and isinstance(sig, pd.Series):
|
||||
return sig.reindex(full_idx).fillna(0).astype(int)
|
||||
except Exception:
|
||||
pass
|
||||
logging.debug("Exception caught", exc_info=True)
|
||||
|
||||
# Fallback: generic composite z-score (same as original loop)
|
||||
composite = pd.Series(0.0, index=full_idx)
|
||||
|
||||
Reference in New Issue
Block a user