Skip to content

Commit 9c9d045

Browse files
authored
Merge pull request #211 from ExpDev07/country_code_remipl
improved efficiency for country_code method.
2 parents 959b029 + 4994cdf commit 9c9d045

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

app/utils/countrycodes.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,10 +373,5 @@ def country_code(country):
373373
if not country in is_3166_1 and country in synonyms:
374374
country = synonyms[country]
375375

376-
# Return code if country was found.
377-
if country in is_3166_1:
378-
return is_3166_1[country]
379-
380-
# Default to default_code.
381-
print("No country_code found for '" + country + "'. Using '" + default_code + "'")
382-
return default_code
376+
# Get country or fallback to default_code.
377+
return is_3166_1.get(country, default_code)

0 commit comments

Comments
 (0)