TypeGuard[float] added to isfloat

This commit is contained in:
Normann 2024-10-07 22:47:36 +02:00 committed by Andreas
parent bddf89b6ee
commit bda6d240d1

View File

@ -2,7 +2,7 @@
import os import os
from datetime import datetime from datetime import datetime
from typing import Any from typing import Any, TypeGuard
import matplotlib import matplotlib
@ -27,7 +27,7 @@ opt_class = optimization_problem(
) )
def isfloat(num: Any) -> bool: def isfloat(num: Any) -> TypeGuard[float]:
"""Check if a given input can be converted to float.""" """Check if a given input can be converted to float."""
if num is None: if num is None:
return False return False