hdx-python-country 3.7.5__tar.gz → 3.7.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/PKG-INFO +1 -1
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/requirements.txt +1 -1
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/_version.py +2 -2
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/adminlevel.py +19 -14
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.config/coveragerc +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.config/pre-commit-config.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.config/pytest.ini +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.config/ruff.toml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.github/workflows/publish.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.gitignore +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/CONTRIBUTING.md +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/LICENSE +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/README.md +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/documentation/main.md +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/documentation/pydoc-markdown.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/pyproject.toml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/country.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/currency.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/phonetics.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/src/hdx/location/wfp_exchangerates.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/adminlevel.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/adminlevelparent.yaml +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/global_pcode_lengths.csv +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/global_pcodes_adm_1_2.csv +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/secondary_historic_rates.csv +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/secondary_rates.json +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/test_adminlevel.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/test_country.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/test_currency.py +0 -0
- {hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
|
@@ -144,8 +144,9 @@ class AdminLevel:
|
|
|
144
144
|
self.pcodes.append(pcode)
|
|
145
145
|
self.pcode_to_name[pcode] = adm_name
|
|
146
146
|
|
|
147
|
+
adm_name = normalise(adm_name)
|
|
147
148
|
name_to_pcode = self.name_to_pcode.get(countryiso3, {})
|
|
148
|
-
name_to_pcode[
|
|
149
|
+
name_to_pcode[adm_name] = pcode
|
|
149
150
|
self.name_to_pcode[countryiso3] = name_to_pcode
|
|
150
151
|
self.pcode_to_iso3[pcode] = countryiso3
|
|
151
152
|
self.pcode_to_iso3[pcode] = countryiso3
|
|
@@ -155,7 +156,7 @@ class AdminLevel:
|
|
|
155
156
|
countryiso3, {}
|
|
156
157
|
)
|
|
157
158
|
name_to_pcode = name_parent_to_pcode.get(parent, {})
|
|
158
|
-
name_to_pcode[
|
|
159
|
+
name_to_pcode[adm_name] = pcode
|
|
159
160
|
name_parent_to_pcode[parent] = name_to_pcode
|
|
160
161
|
self.name_parent_to_pcode[countryiso3] = name_parent_to_pcode
|
|
161
162
|
self.pcode_to_parent[pcode] = parent
|
|
@@ -554,6 +555,7 @@ class AdminLevel:
|
|
|
554
555
|
self,
|
|
555
556
|
countryiso3: str,
|
|
556
557
|
name: str,
|
|
558
|
+
normalised_name: str,
|
|
557
559
|
**kwargs: Any,
|
|
558
560
|
) -> Optional[str]:
|
|
559
561
|
"""Fuzzy match name to pcode
|
|
@@ -561,6 +563,7 @@ class AdminLevel:
|
|
|
561
563
|
Args:
|
|
562
564
|
countryiso3 (str): ISO3 country code
|
|
563
565
|
name (str): Name to match
|
|
566
|
+
normalised_name (str): Normalised name
|
|
564
567
|
**kwargs:
|
|
565
568
|
parent (Optional[str]): Parent admin code
|
|
566
569
|
logname (str): Log using this identifying name. Defaults to not logging.
|
|
@@ -597,13 +600,12 @@ class AdminLevel:
|
|
|
597
600
|
if logname:
|
|
598
601
|
self.errors.add((logname, countryiso3, parent))
|
|
599
602
|
return None
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
adm_name_lookup,
|
|
603
|
+
alt_normalised_name = multiple_replace(
|
|
604
|
+
normalised_name,
|
|
603
605
|
self.get_admin_name_replacements(countryiso3, parent),
|
|
604
606
|
)
|
|
605
607
|
pcode = name_to_pcode.get(
|
|
606
|
-
|
|
608
|
+
normalised_name, name_to_pcode.get(alt_normalised_name)
|
|
607
609
|
)
|
|
608
610
|
if not pcode and name.lower() in self.admin_fuzzy_dont:
|
|
609
611
|
if logname:
|
|
@@ -611,7 +613,7 @@ class AdminLevel:
|
|
|
611
613
|
return None
|
|
612
614
|
if not pcode:
|
|
613
615
|
for map_name in name_to_pcode:
|
|
614
|
-
if
|
|
616
|
+
if normalised_name in map_name:
|
|
615
617
|
pcode = name_to_pcode[map_name]
|
|
616
618
|
if logname:
|
|
617
619
|
self.matches.add(
|
|
@@ -625,7 +627,7 @@ class AdminLevel:
|
|
|
625
627
|
)
|
|
626
628
|
break
|
|
627
629
|
for map_name in name_to_pcode:
|
|
628
|
-
if
|
|
630
|
+
if alt_normalised_name in map_name:
|
|
629
631
|
pcode = name_to_pcode[map_name]
|
|
630
632
|
if logname:
|
|
631
633
|
self.matches.add(
|
|
@@ -659,8 +661,8 @@ class AdminLevel:
|
|
|
659
661
|
|
|
660
662
|
matching_index = self.phonetics.match(
|
|
661
663
|
map_names,
|
|
662
|
-
|
|
663
|
-
alternative_name=
|
|
664
|
+
normalised_name,
|
|
665
|
+
alternative_name=alt_normalised_name,
|
|
664
666
|
transform_possible_names=[al_transform_1, al_transform_2],
|
|
665
667
|
)
|
|
666
668
|
|
|
@@ -754,6 +756,7 @@ class AdminLevel:
|
|
|
754
756
|
)
|
|
755
757
|
return pcode, True
|
|
756
758
|
else:
|
|
759
|
+
normalised_name = normalise(name)
|
|
757
760
|
if parent:
|
|
758
761
|
name_parent_to_pcode = self.name_parent_to_pcode.get(
|
|
759
762
|
countryiso3
|
|
@@ -761,18 +764,20 @@ class AdminLevel:
|
|
|
761
764
|
if name_parent_to_pcode:
|
|
762
765
|
name_to_pcode = name_parent_to_pcode.get(parent)
|
|
763
766
|
if name_to_pcode is not None:
|
|
764
|
-
pcode = name_to_pcode.get(
|
|
767
|
+
pcode = name_to_pcode.get(normalised_name)
|
|
765
768
|
if pcode:
|
|
766
769
|
return pcode, True
|
|
767
770
|
else:
|
|
768
771
|
name_to_pcode = self.name_to_pcode.get(countryiso3)
|
|
769
772
|
if name_to_pcode is not None:
|
|
770
|
-
pcode = name_to_pcode.get(
|
|
773
|
+
pcode = name_to_pcode.get(normalised_name)
|
|
771
774
|
if pcode:
|
|
772
775
|
return pcode, True
|
|
773
|
-
if not fuzzy_match or len(
|
|
776
|
+
if not fuzzy_match or len(normalised_name) < fuzzy_length:
|
|
774
777
|
return None, True
|
|
775
|
-
pcode = self.fuzzy_pcode(
|
|
778
|
+
pcode = self.fuzzy_pcode(
|
|
779
|
+
countryiso3, name, normalised_name, **kwargs
|
|
780
|
+
)
|
|
776
781
|
return pcode, False
|
|
777
782
|
|
|
778
783
|
def output_matches(self) -> List[str]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/.github/workflows/run-python-tests.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/global_pcode_lengths.csv
RENAMED
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/global_pcodes_adm_1_2.csv
RENAMED
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/fixtures/secondary_historic_rates.csv
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/Countries_UZB_Deleted.csv
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.5 → hdx_python_country-3.7.6}/tests/hdx/location/test_wfp_exchangerates.py
RENAMED
|
File without changes
|