hdx-python-country 3.8.1__tar.gz → 3.8.2__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.
Files changed (36) hide show
  1. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/PKG-INFO +1 -1
  2. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/requirements.txt +9 -11
  3. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/_version.py +2 -2
  4. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/adminlevel.py +35 -1
  5. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/adminlevel.yaml +1 -1
  6. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/test_adminlevel.py +1 -1
  7. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.config/coveragerc +0 -0
  8. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.config/pre-commit-config.yaml +0 -0
  9. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.config/pytest.ini +0 -0
  10. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.config/ruff.toml +0 -0
  11. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.github/workflows/publish.yaml +0 -0
  12. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.github/workflows/run-python-tests.yaml +0 -0
  13. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/.gitignore +0 -0
  14. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/CONTRIBUTING.md +0 -0
  15. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/LICENSE +0 -0
  16. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/README.md +0 -0
  17. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/documentation/.readthedocs.yaml +0 -0
  18. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/documentation/main.md +0 -0
  19. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/documentation/pydoc-markdown.yaml +0 -0
  20. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/pyproject.toml +0 -0
  21. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
  22. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/__init__.py +0 -0
  23. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/country.py +0 -0
  24. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/currency.py +0 -0
  25. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/phonetics.py +0 -0
  26. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/src/hdx/location/wfp_exchangerates.py +0 -0
  27. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/adminlevelparent.yaml +0 -0
  28. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/download-global-pcode-lengths.csv +0 -0
  29. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/download-global-pcodes-adm-1-2.csv +0 -0
  30. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/secondary_historic_rates.csv +0 -0
  31. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/fixtures/secondary_rates.json +0 -0
  32. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
  33. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/__init__.py +0 -0
  34. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/test_country.py +0 -0
  35. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/test_currency.py +0 -0
  36. {hdx_python_country-3.8.1 → hdx_python_country-3.8.2}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hdx-python-country
3
- Version: 3.8.1
3
+ Version: 3.8.2
4
4
  Summary: HDX Python country code and exchange rate (fx) utilities
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-country
6
6
  Author: Michael Rans
@@ -14,13 +14,13 @@ cfgv==3.4.0
14
14
  # via pre-commit
15
15
  chardet==5.2.0
16
16
  # via frictionless
17
- charset-normalizer==3.3.2
17
+ charset-normalizer==3.4.0
18
18
  # via requests
19
19
  click==8.1.7
20
20
  # via typer
21
- coverage==7.6.1
21
+ coverage==7.6.3
22
22
  # via pytest-cov
23
- distlib==0.3.8
23
+ distlib==0.3.9
24
24
  # via virtualenv
25
25
  et-xmlfile==1.1.0
26
26
  # via openpyxl
@@ -40,19 +40,19 @@ ijson==3.3.0
40
40
  # via hdx-python-utilities
41
41
  iniconfig==2.0.0
42
42
  # via pytest
43
- isodate==0.6.1
43
+ isodate==0.7.2
44
44
  # via frictionless
45
45
  jinja2==3.1.4
46
46
  # via frictionless
47
47
  jsonlines==4.0.0
48
48
  # via hdx-python-utilities
49
- jsonpath-ng==1.6.1
49
+ jsonpath-ng==1.7.0
50
50
  # via libhxl
51
51
  jsonschema==4.23.0
52
52
  # via
53
53
  # frictionless
54
54
  # tableschema-to-template
55
- jsonschema-specifications==2023.12.1
55
+ jsonschema-specifications==2024.10.1
56
56
  # via jsonschema
57
57
  libhxl==5.2.1
58
58
  # via hdx-python-country (pyproject.toml)
@@ -62,7 +62,7 @@ markdown-it-py==3.0.0
62
62
  # via rich
63
63
  marko==2.1.2
64
64
  # via frictionless
65
- markupsafe==2.1.5
65
+ markupsafe==3.0.1
66
66
  # via jinja2
67
67
  mdurl==0.1.2
68
68
  # via markdown-it-py
@@ -82,7 +82,7 @@ ply==3.11
82
82
  # via
83
83
  # jsonpath-ng
84
84
  # libhxl
85
- pre-commit==4.0.0
85
+ pre-commit==4.0.1
86
86
  # via hdx-python-country (pyproject.toml)
87
87
  pydantic==2.9.2
88
88
  # via frictionless
@@ -142,9 +142,7 @@ shellingham==1.5.4
142
142
  simpleeval==1.0.0
143
143
  # via frictionless
144
144
  six==1.16.0
145
- # via
146
- # isodate
147
- # python-dateutil
145
+ # via python-dateutil
148
146
  stringcase==1.2.0
149
147
  # via frictionless
150
148
  structlog==24.4.0
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.8.1'
16
- __version_tuple__ = version_tuple = (3, 8, 1)
15
+ __version__ = version = '3.8.2'
16
+ __version_tuple__ = version_tuple = (3, 8, 2)
@@ -602,6 +602,38 @@ class AdminLevel:
602
602
  continue
603
603
  return relevant_name_replacements
604
604
 
605
+ def get_admin_fuzzy_dont(
606
+ self, countryiso3: str, parent: Optional[str]
607
+ ) -> List[str]:
608
+ """Get relevant admin names that should not be fuzzy matched from
609
+ admin fuzzy dont which is a list of strings. These can be global
610
+ or they can be restricted by country or parent. Keys take the form
611
+ "DONT_MATCH", "AFG|DONT_MATCH", or "AF01|DONT_MATCH".
612
+
613
+ Args:
614
+ countryiso3 (str): ISO3 country code
615
+ parent (Optional[str]): Parent admin code
616
+
617
+ Returns:
618
+ List[str]: Relevant admin names that should not be fuzzy matched
619
+ """
620
+ relevant_admin_fuzzy_dont = []
621
+ for value in self.admin_fuzzy_dont:
622
+ if "|" not in value:
623
+ if value not in relevant_admin_fuzzy_dont:
624
+ relevant_admin_fuzzy_dont.append(value)
625
+ continue
626
+ prefix, name = value.split("|")
627
+ if parent:
628
+ if prefix == parent:
629
+ if name not in relevant_admin_fuzzy_dont:
630
+ relevant_admin_fuzzy_dont.append(name)
631
+ if prefix == countryiso3:
632
+ if name not in relevant_admin_fuzzy_dont:
633
+ relevant_admin_fuzzy_dont.append(name)
634
+ continue
635
+ return relevant_admin_fuzzy_dont
636
+
605
637
  def fuzzy_pcode(
606
638
  self,
607
639
  countryiso3: str,
@@ -658,7 +690,9 @@ class AdminLevel:
658
690
  pcode = name_to_pcode.get(
659
691
  normalised_name, name_to_pcode.get(alt_normalised_name)
660
692
  )
661
- if not pcode and name.lower() in self.admin_fuzzy_dont:
693
+ if not pcode and name.lower() in self.get_admin_fuzzy_dont(
694
+ countryiso3, parent
695
+ ):
662
696
  if logname:
663
697
  self.ignored.add((logname, countryiso3, name))
664
698
  return None
@@ -516,7 +516,7 @@ admin_name_replacements:
516
516
  " oblast": ""
517
517
 
518
518
  admin_fuzzy_dont:
519
- - "nord"
519
+ - "YEM|nord"
520
520
  - "north"
521
521
  - "sud"
522
522
  - "south"
@@ -421,7 +421,7 @@ class TestAdminLevel:
421
421
  adminone = AdminLevel(config)
422
422
  adminone.setup_from_url()
423
423
  assert adminone.get_admin_level("YEM") == 1
424
- assert len(adminone.get_pcode_list()) == 2510
424
+ assert len(adminone.get_pcode_list()) == 2526
425
425
  assert adminone.get_pcode_length("YEM") == 4
426
426
  assert adminone.get_pcode("YEM", "YE30", logname="test") == (
427
427
  "YE30",