hdx-python-country 4.2.1__tar.gz → 4.2.3__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-4.2.1 → hdx_python_country-4.2.3}/PKG-INFO +2 -2
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/documentation/index.md +4 -1
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/pyproject.toml +1 -1
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/_version.py +2 -2
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/adminlevel.py +6 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/adminlevelparent.yaml +1 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/test_adminlevel.py +8 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/.github/workflows/publish.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/.gitignore +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/.pre-commit-config.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/LICENSE +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/README.md +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/documentation/mkdocs.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy.csv +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/__init__.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/country.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/currency.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/int_timestamp.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/wfp_api.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/src/hdx/location/wfp_exchangerates.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/adminlevel.yaml +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/fixtures-download-global-pcode-lengths.csv +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/fixtures-download-global-pcodes-adm-1-2.csv +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/secondary_historic_rates.csv +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/secondary_rates.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_List_1.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_List_2.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_1.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_10.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_2.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_3.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_4.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_5.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_6.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_7.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_8.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_9.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Markets_List_AFG_1.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Markets_List_AFG_2.json +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/__init__.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/conftest.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/test_country.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/test_currency.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
- {hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: hdx-python-country
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.3
|
|
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
|
Project-URL: Repository, https://github.com/OCHA-DAP/hdx-python-country
|
|
@@ -27,7 +27,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
27
27
|
Classifier: Programming Language :: Python :: 3.14
|
|
28
28
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
29
29
|
Requires-Python: >=3.10
|
|
30
|
-
Requires-Dist: hdx-python-utilities<5,>=4.2.
|
|
30
|
+
Requires-Dist: hdx-python-utilities<5,>=4.2.1
|
|
31
31
|
Requires-Dist: tenacity
|
|
32
32
|
Provides-Extra: docs
|
|
33
33
|
Requires-Dist: mkapi; extra == 'docs'
|
|
@@ -151,7 +151,10 @@ matching. Default is all countries.
|
|
|
151
151
|
*admin_name_mappings* is a dictionary of mappings from name to pcode. These can
|
|
152
152
|
be global or they can be restricted by country or parent (if the AdminLevel
|
|
153
153
|
object has been set up with parents). Keys take the form "MAPPING",
|
|
154
|
-
"AFG|MAPPING" or "AF01|MAPPING".
|
|
154
|
+
"AFG|MAPPING" or "AF01|MAPPING". A mapping keyed by parent is used even if
|
|
155
|
+
its pcode has a different parent (eg. "ET07|Dawuro": "ET1104" where ET07 is a
|
|
156
|
+
pre-split region). Other mappings are only used with a parent if the pcode's
|
|
157
|
+
parent matches it.
|
|
155
158
|
*admin_name_replacements* is a dictionary of textual replacements to try when
|
|
156
159
|
fuzzy matching. It maps from string to string replacement. The replacements can
|
|
157
160
|
be global or they can be restricted by country or parent (if the AdminLevel
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '4.2.
|
|
22
|
-
__version_tuple__ = version_tuple = (4, 2,
|
|
21
|
+
__version__ = version = '4.2.3'
|
|
22
|
+
__version_tuple__ = version_tuple = (4, 2, 3)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -751,6 +751,12 @@ class AdminLevel:
|
|
|
751
751
|
parent = kwargs.get("parent")
|
|
752
752
|
else:
|
|
753
753
|
parent = None
|
|
754
|
+
if parent:
|
|
755
|
+
# A parent-keyed mapping is trusted even if its p-code has a
|
|
756
|
+
# different parent eg. a pre-split region name
|
|
757
|
+
pcode = self._admin_name_mappings.get(f"{parent}|{name}")
|
|
758
|
+
if pcode and self.pcode_to_iso3[pcode] == countryiso3:
|
|
759
|
+
return pcode, True
|
|
754
760
|
pcode = self.get_name_mapped_pcode(countryiso3, name, parent)
|
|
755
761
|
if pcode and self.pcode_to_iso3[pcode] == countryiso3:
|
|
756
762
|
if parent:
|
|
@@ -340,6 +340,7 @@ class TestAdminLevel:
|
|
|
340
340
|
"MyMapping: Charikar (AF0301)",
|
|
341
341
|
"AFG|MyMapping2: Maydan Shahr (AF0401)",
|
|
342
342
|
"AF05|MyMapping3: Pul-e-Alam (AF0501)",
|
|
343
|
+
"AF05|MyMapping4: Maydan Shahr (AF0401)",
|
|
343
344
|
]
|
|
344
345
|
assert admintwo.get_pcode("AFG", "MyMapping", logname="test") == (
|
|
345
346
|
"AF0301",
|
|
@@ -374,6 +375,13 @@ class TestAdminLevel:
|
|
|
374
375
|
"AFG", "MyMapping3", parent="AF04", logname="test"
|
|
375
376
|
) == (None, False)
|
|
376
377
|
|
|
378
|
+
assert admintwo.get_pcode(
|
|
379
|
+
"AFG", "MyMapping4", parent="AF05", logname="test"
|
|
380
|
+
) == ("AF0401", True)
|
|
381
|
+
assert admintwo.get_pcode(
|
|
382
|
+
"AFG", "MyMapping4", parent="AF04", logname="test"
|
|
383
|
+
) == (None, False)
|
|
384
|
+
|
|
377
385
|
# Names are garbled so that only the "qx" replacement, not fuzzy
|
|
378
386
|
# matching, can resolve them. That tests replacement scoping whatever
|
|
379
387
|
# the matcher.
|
|
File without changes
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/.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-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/secondary_historic_rates.csv
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_List_1.json
RENAMED
|
File without changes
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Currency_List_2.json
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
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Markets_List_AFG_1.json
RENAMED
|
File without changes
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/tests/fixtures/wfp/Markets_List_AFG_2.json
RENAMED
|
File without changes
|
{hdx_python_country-4.2.1 → hdx_python_country-4.2.3}/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-4.2.1 → hdx_python_country-4.2.3}/tests/hdx/location/test_wfp_exchangerates.py
RENAMED
|
File without changes
|
|
File without changes
|