Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def validate_result(self, pattern_text):
pattern_text = pattern_text.replace(' ', '')
is_valid_checksum = (IbanRecognizer.__generate_iban_check_digits(
pattern_text) == pattern_text[2:4])
# score = EntityRecognizer.MIN_SCORE
result = False
if is_valid_checksum:
if IbanRecognizer.__is_valid_format(pattern_text):
result = True
elif IbanRecognizer.__is_valid_format(pattern_text.upper()):
result = None
return result
def validate_result(self, pattern_text):
pattern_text = pattern_text.replace(' ', '')
is_valid_checksum = (IbanRecognizer.__generate_iban_check_digits(
pattern_text) == pattern_text[2:4])
# score = EntityRecognizer.MIN_SCORE
result = False
if is_valid_checksum:
if IbanRecognizer.__is_valid_format(pattern_text):
result = True
elif IbanRecognizer.__is_valid_format(pattern_text.upper()):
result = None
return result
def __generate_iban_check_digits(iban):
transformed_iban = (iban[:2] + '00' + iban[4:]).upper()
number_iban = IbanRecognizer.__number_iban(transformed_iban)
return '{:0>2}'.format(98 - (int(number_iban) % 97))