Skip to content

Commit 7ebcc17

Browse files
author
ExpDev07
committed
improved efficiency
1 parent 959b029 commit 7ebcc17

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

app/utils/countrycodes.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -372,11 +372,6 @@ def country_code(country):
372372
# Look in synonyms if not found.
373373
if not country in is_3166_1 and country in synonyms:
374374
country = synonyms[country]
375-
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
375+
376+
# Get country or fallback to default_code.
377+
return is_3166_1.get(country, default_code)

0 commit comments

Comments
 (0)