Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.countries = [geocoder.region_code_for_number(number)]
self.label = phonenumbers.format_number(number, self.FORMAT)
self.key = self.label
def _parse(self, number, region=None):
try:
num = phonenumbers.parse(number, region)
if phonenumbers.is_possible_number(num):
if phonenumbers.is_valid_number(num):
return num
except phonenumbers.NumberParseException:
pass
class IBANResult(Result):
category = ExtractedEntity.IBAN
def __init__(self, ctx, label, start, end):
super(IBANResult, self).__init__(ctx, label, start, end)
try:
iban = IBAN(label)
self.key = self.label = iban.compact
self.countries = [iban.country_code]
except ValueError:
self.valid = False