Skip to content

Commit

Permalink
Fix fuction issue
Browse files Browse the repository at this point in the history
  • Loading branch information
promans718 committed Oct 8, 2024
1 parent a53e5c3 commit d19b12c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions toolium/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,12 @@ def _get_rounded_float_number(param):
:param param: param to format
:return: float as string with the expected decimals
"""
type_mapping_regex = r'\[(ROUND):([\w\W]*)\]'
type_mapping_match_group = re.match(type_mapping_regex, param)
if type_mapping_match_group and type_mapping_match_group.group(1) == 'ROUND':
replace_params = type_mapping_match_group.group(2).split('::')
replace_param = f"{round(float(replace_params[0]), int(replace_params[1])):.{int(replace_params[1])}f}"
return replace_param
return ''
type_regex = r'\[(ROUND):(.*)::(\d)*\]'
type_match = re.match(type_regex, param)
if type_match and type_match.group(1) == 'ROUND':
if type_match.group(3).isdigit():
replace_param = f"{round(float(type_match.group(2)), int(type_match.group(3))):.{int(type_match.group(3))}f}"
return replace_param


def _get_random_phone_number():
Expand Down

0 comments on commit d19b12c

Please sign in to comment.