MCPcopy Create free account
hub / github.com/Boris-code/feapder / ensure_float

Function ensure_float

feapder/utils/tools.py:2807–2820  ·  view source on GitHub ↗

>>> ensure_float(None) 0.0 >>> ensure_float(False) 0.0 >>> ensure_float(12) 12.0 >>> ensure_float("72") 72.0

(n)

Source from the content-addressed store, hash-verified

2805
2806
2807def ensure_float(n):
2808 """
2809 >>> ensure_float(None)
2810 0.0
2811 >>> ensure_float(False)
2812 0.0
2813 >>> ensure_float(12)
2814 12.0
2815 >>> ensure_float("72")
2816 72.0
2817 """
2818 if not n:
2819 return 0.0
2820 return float(n)
2821
2822
2823def import_cls(cls_info):

Callers 1

get_timer_pointMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected