Spaces:
Running
Running
Update engine/live_game_engine.py
Browse files
engine/live_game_engine.py
CHANGED
|
@@ -27,6 +27,15 @@ def _safe_float(value: Any) -> float | None:
|
|
| 27 |
except Exception:
|
| 28 |
return None
|
| 29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
def _extract_latest_savant_pitch_metrics(savant_feed: dict[str, Any]) -> dict[str, Any]:
|
| 32 |
"""
|
|
|
|
| 27 |
except Exception:
|
| 28 |
return None
|
| 29 |
|
| 30 |
+
def _first_non_null(*values):
|
| 31 |
+
for value in values:
|
| 32 |
+
if value is None:
|
| 33 |
+
continue
|
| 34 |
+
text = str(value).strip().lower()
|
| 35 |
+
if text in {"", "nan", "none"}:
|
| 36 |
+
continue
|
| 37 |
+
return value
|
| 38 |
+
return None
|
| 39 |
|
| 40 |
def _extract_latest_savant_pitch_metrics(savant_feed: dict[str, Any]) -> dict[str, Any]:
|
| 41 |
"""
|