File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1+ import logging
12from itertools import chain
23
4+ LOGGER = logging .getLogger (__name__ )
5+
36# Default country code.
47default_code = "XX"
58
@@ -374,4 +377,11 @@ def country_code(country):
374377 country = synonyms [country ]
375378
376379 # Get country or fallback to default_code.
377- return is_3166_1 .get (country , default_code )
380+ country_code = is_3166_1 .get (country , default_code )
381+
382+ # Default picked?
383+ if country_code == default_code :
384+ LOGGER .warning (f"No country_code found for '{ country } '. Using '{ country_code } '!" )
385+
386+ # Return.
387+ return country_code
Original file line number Diff line number Diff line change 1+ import logging
12from io import BytesIO , StringIO
23from zipfile import ZipFile , ZipInfo
34
67
78from .countrycodes import country_code
89
10+ LOGGER = logging .getLogger (__name__ )
911
1012# Fetching of the populations.
1113def fetch_populations ():
@@ -15,7 +17,7 @@ def fetch_populations():
1517 :returns: The mapping of populations.
1618 :rtype: dict
1719 """
18- print ("Fetching populations..." )
20+ LOGGER . info ("Fetching populations..." )
1921
2022 # Mapping of populations
2123 mappings = {}
You can’t perform that action at this time.
0 commit comments