Skip to content

Commit 1402709

Browse files
committed
style: black formatting on cli_commands + self_calibrator
1 parent 94cbe18 commit 1402709

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/slop_detector/cli_commands.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ def _check_calibration_hint(args) -> None:
343343
config = Config(config_path=getattr(args, "config", None))
344344
current_weights = config.get_weights()
345345
# P3: use current config weights as domain anchor to constrain grid search
346-
domain_anchor = {k: current_weights.get(k, 0.30) for k in ("ldr", "inflation", "ddc", "purity")}
346+
domain_anchor = {
347+
k: current_weights.get(k, 0.30) for k in ("ldr", "inflation", "ddc", "purity")
348+
}
347349
result = SelfCalibrator().calibrate(
348350
current_weights=current_weights,
349351
project_id=project_id,

src/slop_detector/ml/self_calibrator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ def calibrate(
151151
current_weights: Optional[Dict[str, float]] = None,
152152
min_events: int = MIN_IMPROVEMENTS, # per-class floor; applies to both improvement and fp_candidate classes
153153
project_id: Optional[str] = None, # P1: restrict history to this project
154-
domain_anchor: Optional[Dict[str, float]] = None, # P3: constrain grid to ±DOMAIN_TOLERANCE of anchor
154+
domain_anchor: Optional[
155+
Dict[str, float]
156+
] = None, # P3: constrain grid to ±DOMAIN_TOLERANCE of anchor
155157
) -> CalibrationResult:
156158
"""Run self-calibration. Returns CalibrationResult with optimal weights.
157159
@@ -547,11 +549,13 @@ def _grid_search(
547549
max_p = int(MAX_PURITY_WEIGHT * GRID_STEP) # purity ceiling: 0.25 * 20 = 5
548550

549551
if domain_anchor:
552+
550553
def _dim_bounds(key: str, hard_max: int = max_i) -> Tuple[int, int]:
551554
anchor_v = domain_anchor.get(key, 0.30)
552555
lo = max(min_i, int(round(max(MIN_W, anchor_v - DOMAIN_TOLERANCE) * GRID_STEP)))
553556
hi = min(hard_max, int(round(min(MAX_W, anchor_v + DOMAIN_TOLERANCE) * GRID_STEP)))
554557
return lo, hi
558+
555559
ldr_lo, ldr_hi = _dim_bounds("ldr")
556560
inf_lo, inf_hi = _dim_bounds("inflation")
557561
ddc_lo, ddc_hi = _dim_bounds("ddc")

0 commit comments

Comments
 (0)