Fix nargs="?" without type does not properly cast the default value (#531)

This commit is contained in:
allegroai 2022-02-03 15:29:56 +02:00
parent 34fc80b039
commit e98e6acae1

View File

@ -313,6 +313,12 @@ class _Arguments(object):
# now we should try and cast the value if we can
# noinspection PyBroadException
try:
# Since we have no actual var type here, we check if the string presentation of the original
# default value and the new value are the same, if they are,
# we should just use the original default value
if str(v) == str(current_action.default):
v = current_action.default
else:
v = var_type(v)
# cast back to int if it's the same value
if type(current_action.default) == int and int(v) == v: