from __future__ import annotations from typing import Any def normalize_text(value: Any) -> str: if value is None: return "" return str(value).strip() def parse_int_or_none(value: Any) -> int | None: text = normalize_text(value) if text == "": return None try: return int(float(text)) except ValueError: return None def parse_float_or_none(value: Any) -> float | None: text = normalize_text(value) if text == "": return None try: return float(text) except ValueError: cleaned = text.replace(",", "").replace(",", "") try: return float(cleaned) except ValueError: return None