Skip to content

Commit

Permalink
fix: update __string_value_to_numeric method
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekzyla committed Jul 7, 2023
1 parent 1e146c9 commit 3f7bbdf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions backend/SC4SNMP_UI_backend/common/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@ def __init__(self, *args, **kwargs):
self.__ui2backend_profile_types[value] = key

def __string_value_to_numeric(self, value: str):
if value.isnumeric():
value = int(value)
elif value.replace(".", "").isnumeric():
value = float(value)
return value
try:
if value.isnumeric():
return int(value)
elif value.replace(".", "").isnumeric():
return float(value)
except ValueError:
return value

def _backend2ui_map(self, document: dict, **kwargs):
profile_name = None
Expand Down

0 comments on commit 3f7bbdf

Please sign in to comment.