(r: RouteRecord)
| 226 | |
| 227 | |
| 228 | def _baseline_cost(r: RouteRecord) -> float: |
| 229 | if r.baseline_cost > 0: |
| 230 | return r.baseline_cost |
| 231 | main_estimated = max(0.0, r.estimated_cost - r.sidechannel_estimated_cost) |
| 232 | if main_estimated <= 0: |
| 233 | return 0.0 |
| 234 | if 0.0 <= r.savings < 0.999999: |
| 235 | denominator = 1.0 - r.savings |
| 236 | if denominator > 0: |
| 237 | return main_estimated / denominator |
| 238 | if r.savings == 0.0: |
| 239 | return main_estimated |
| 240 | return 0.0 |
| 241 | |
| 242 | |
| 243 | def _get_stats_pricing() -> dict[str, ModelPricing]: |