Source code for opatio.misc.misc

from typing import List, Any

from opatio.catalog.entry import CardCatalogEntry

[docs] def is_float_castable(value: Any) -> bool: """ Check if a value can be cast to a float. Parameters ---------- value : Any The value to check. Returns ------- bool True if the value can be cast to a float, False otherwise. Examples -------- >>> is_float_castable("123.45") True >>> is_float_castable("abc") False """ try: float(value) return True except ValueError: return False