resolving an issue where missing values for 'flags' in the Shipcall would cause rule-violations
This commit is contained in:
parent
e526337c6a
commit
22009eb469
@ -18,6 +18,9 @@ def check_if_string_has_special_characters(text:typing.Optional[str]):
|
|||||||
|
|
||||||
|
|
||||||
def check_if_int_is_valid_flag(value, enum_object):
|
def check_if_int_is_valid_flag(value, enum_object):
|
||||||
|
if value is None: # when no value is provided, the value is considered valid.
|
||||||
|
return False
|
||||||
|
|
||||||
# e.g., when an IntFlag has the values 1,2,4; the maximum valid value is 7
|
# e.g., when an IntFlag has the values 1,2,4; the maximum valid value is 7
|
||||||
max_int = sum([int(val) for val in list(enum_object._value2member_map_.values())])
|
max_int = sum([int(val) for val in list(enum_object._value2member_map_.values())])
|
||||||
return 0 < value <= max_int
|
return 0 < value <= max_int
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user