hdx-python-country 3.7.9__tar.gz → 3.8.0__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.9 → hdx_python_country-3.8.0}/PKG-INFO +1 -1
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/documentation/main.md +4 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/requirements.txt +4 -4
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/_version.py +2 -2
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/adminlevel.py +11 -7
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.config/coveragerc +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.config/pre-commit-config.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.config/pytest.ini +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.config/ruff.toml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.github/workflows/publish.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.github/workflows/run-python-tests.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.gitignore +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/CONTRIBUTING.md +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/LICENSE +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/README.md +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/documentation/.readthedocs.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/documentation/pydoc-markdown.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/pyproject.toml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/country.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/currency.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/phonetics.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/src/hdx/location/wfp_exchangerates.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/adminlevel.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/adminlevelparent.yaml +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/download-global-pcode-lengths.csv +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/download-global-pcodes-adm-1-2.csv +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/secondary_historic_rates.csv +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/secondary_rates.json +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/__init__.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/test_adminlevel.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/test_country.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/test_currency.py +0 -0
- {hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
|
@@ -130,6 +130,10 @@ object has been set up with parents). Keys take the form "STRING_TO_REPLACE",
|
|
|
130
130
|
*admin_fuzzy_dont* is a list of names for which fuzzy matching should not be
|
|
131
131
|
tried
|
|
132
132
|
|
|
133
|
+
A Retrieve object can be passed in the *retriever* parameter that enables
|
|
134
|
+
saving data downloaded to a file or loading previously saved data depending
|
|
135
|
+
on how the Retrieve object is configured.
|
|
136
|
+
|
|
133
137
|
Once an AdminLevel object is constructed, one of three setup methods must be
|
|
134
138
|
called: *setup_from_admin_info*, *setup_from_libhxl_dataset* or
|
|
135
139
|
*setup_from_url*.
|
|
@@ -30,7 +30,7 @@ frictionless==5.18.0
|
|
|
30
30
|
# via hdx-python-utilities
|
|
31
31
|
hdx-python-utilities==3.7.4
|
|
32
32
|
# via hdx-python-country (pyproject.toml)
|
|
33
|
-
humanize==4.
|
|
33
|
+
humanize==4.11.0
|
|
34
34
|
# via frictionless
|
|
35
35
|
identify==2.6.1
|
|
36
36
|
# via pre-commit
|
|
@@ -82,7 +82,7 @@ ply==3.11
|
|
|
82
82
|
# via
|
|
83
83
|
# jsonpath-ng
|
|
84
84
|
# libhxl
|
|
85
|
-
pre-commit==
|
|
85
|
+
pre-commit==4.0.0
|
|
86
86
|
# via hdx-python-country (pyproject.toml)
|
|
87
87
|
pydantic==2.9.2
|
|
88
88
|
# via frictionless
|
|
@@ -127,7 +127,7 @@ requests-file==2.1.0
|
|
|
127
127
|
# via hdx-python-utilities
|
|
128
128
|
rfc3986==2.0.0
|
|
129
129
|
# via frictionless
|
|
130
|
-
rich==13.9.
|
|
130
|
+
rich==13.9.2
|
|
131
131
|
# via typer
|
|
132
132
|
rpds-py==0.20.0
|
|
133
133
|
# via
|
|
@@ -139,7 +139,7 @@ ruamel-yaml-clib==0.2.8
|
|
|
139
139
|
# via ruamel-yaml
|
|
140
140
|
shellingham==1.5.4
|
|
141
141
|
# via typer
|
|
142
|
-
simpleeval==0.
|
|
142
|
+
simpleeval==1.0.0
|
|
143
143
|
# via frictionless
|
|
144
144
|
six==1.16.0
|
|
145
145
|
# via
|
|
@@ -115,20 +115,24 @@ class AdminLevel:
|
|
|
115
115
|
admin_url = cls._admin_url_default
|
|
116
116
|
cls._admin_url = admin_url
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
@staticmethod
|
|
119
|
+
def get_libhxl_dataset(
|
|
120
|
+
url: str = _admin_url, retriever: Optional[Retrieve] = None
|
|
121
|
+
) -> hxl.Dataset:
|
|
119
122
|
"""
|
|
120
123
|
Get libhxl Dataset object given a URL which defaults to global p-codes
|
|
121
124
|
dataset on HDX.
|
|
122
125
|
|
|
123
126
|
Args:
|
|
124
|
-
|
|
127
|
+
url (str): URL from which to load data. Defaults to internal admin url.
|
|
128
|
+
retriever (Optional[Retrieve]): Retriever object to use for loading file. Defaults to None.
|
|
125
129
|
|
|
126
130
|
Returns:
|
|
127
|
-
|
|
131
|
+
hxl.Dataset: HXL Dataset object
|
|
128
132
|
"""
|
|
129
|
-
if
|
|
133
|
+
if retriever:
|
|
130
134
|
try:
|
|
131
|
-
url_to_use =
|
|
135
|
+
url_to_use = retriever.download_file(url)
|
|
132
136
|
except DownloadError:
|
|
133
137
|
logger.exception(
|
|
134
138
|
f"Setup of libhxl Dataset object with {url} failed!"
|
|
@@ -271,7 +275,7 @@ class AdminLevel:
|
|
|
271
275
|
Returns:
|
|
272
276
|
None
|
|
273
277
|
"""
|
|
274
|
-
admin_info = self.get_libhxl_dataset(admin_url)
|
|
278
|
+
admin_info = self.get_libhxl_dataset(admin_url, self.retriever)
|
|
275
279
|
self.setup_from_libhxl_dataset(admin_info, countryiso3s)
|
|
276
280
|
|
|
277
281
|
def load_pcode_formats(self, formats_url: str = _formats_url) -> None:
|
|
@@ -284,7 +288,7 @@ class AdminLevel:
|
|
|
284
288
|
Returns:
|
|
285
289
|
None
|
|
286
290
|
"""
|
|
287
|
-
formats_info = self.get_libhxl_dataset(formats_url)
|
|
291
|
+
formats_info = self.get_libhxl_dataset(formats_url, self.retriever)
|
|
288
292
|
for row in formats_info:
|
|
289
293
|
pcode_format = [int(row.get("#country+len"))]
|
|
290
294
|
for admin_no in range(1, 4):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/.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
|
|
File without changes
|
{hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/tests/fixtures/secondary_historic_rates.csv
RENAMED
|
File without changes
|
|
File without changes
|
{hdx_python_country-3.7.9 → hdx_python_country-3.8.0}/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.9 → hdx_python_country-3.8.0}/tests/hdx/location/test_wfp_exchangerates.py
RENAMED
|
File without changes
|