summaryrefslogtreecommitdiff
path: root/lib/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.py')
-rw-r--r--lib/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/utils.py b/lib/utils.py
index 879a53d..3778fc0 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -124,9 +124,11 @@ def soft_cast_int_or_float(n):
If `n` is empty, returns None.
If `n` is not numeric, it is left unchanged.
"""
+ if type(n) in (float, int):
+ return n
if n is None or n == "":
return None
- if "." in n:
+ if type(n) is str and "." in n:
return soft_cast_float(n)
return soft_cast_int(n)