Closed mtbike61384 closed 1 year ago
Hi @mtbike61384 - thanks for submitting an issue. I'll try and take a look soon. Do you have any screenshots or output showing them failing for a specific case?
No sorry I didn't take any screenshots but was just trying to run the command with those flags on the command line. For the -e flag I even tried 30.0 as the default and got the error. I ended up fixing both by replacing the type with either int or float for the respective number type. So like int(value) vs type(value)
Sent from Yahoo Mail on Android
On Tue, Oct 4, 2022 at 9:11 PM, @.***> wrote:
Hi @mtbike61384 - thanks for submitting an issue. I'll try and take a look soon. Do you have any screenshots or output showing them failing for a specific case?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
You're 100% right...the code was introduced in this PR https://github.com/opsdisk/metagoofil/pull/25/files
It was my fault for not actually testing and validating it.
@cknabs - should the code have been this? Like you provided in your comment here - https://github.com/opsdisk/metagoofil/pull/25#discussion_r650739127 ? It works if I cast each of the values as either int or float.
def positive_int(value):
try:
value_int = int(value)
assert value_int >= 0
return value_int
except (AssertionError, ValueError):
raise argparse.ArgumentTypeError(f"invalid value '{value}', must be an int >= 0")
def positive_float(value):
try:
value_float = float(value)
assert value_float >= 0
return value_float
except (AssertionError, ValueError):
raise argparse.ArgumentTypeError(f"invalid value '{value}', must be a float >= 0")
No worries. Yeah the code below is similar to how I fixed it on my end but validation is always key!
Sent from Yahoo Mail on Android
On Sun, Oct 9, 2022 at 8:06 AM, @.***> wrote:
You're 100% right...the code was introduced in this PR https://github.com/opsdisk/metagoofil/pull/25/files
It was my fault for not actually testing and validating it.
@cknabs - should the code have been this? Like you provided in your comment here - #25 (comment) ? It works if I cast each of the values as either int or float. def positive_int(value): try: value_int = int(value) assert value_int >= 0 return value_int except (AssertionError, ValueError): raise argparse.ArgumentTypeError(f"invalid value '{value}', must be an int >= 0")
def positive_float(value): try: value_float = float(value) assert value_float >= 0 return value_float except (AssertionError, ValueError): raise argparse.ArgumentTypeError(f"invalid value '{value}', must be a float >= 0") — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Fixed in https://github.com/opsdisk/metagoofil/pull/28
Thanks for reporting it again @mtbike61384 !
Both of your functions for positive_int and positive_float are broken. I think the issue is that you are calling type on the value which can't be greater than 0 since type is not an integer or float.