Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def country(self, name):
self.country_name = name
self.country_code = countrynames.to_code(name)
def normalize_country(name):
return countrynames.to_code(name)
def normalize_country(self, name):
return countrynames.to_code(name)
def parse_country(country, guess=True):
"""Determine a two-letter country code based on an input.
The input may be a country code, a country name, etc.
"""
if guess:
country = countrynames.to_code(country)
if country is not None:
country = country.lower()
if is_country_code(country):
return country
def clean_text(self, country, fuzzy=False, **kwargs):
"""Determine a two-letter country code based on an input.
The input may be a country code, a country name, etc.
"""
code = country.lower().strip()
if code in self.codes:
return code
country = countrynames.to_code(country, fuzzy=fuzzy)
if country is not None:
return country.lower()