hdx-python-country 3.8.5__tar.gz → 3.8.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.
Files changed (49) hide show
  1. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.config/pre-commit-config.yaml +2 -2
  2. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/PKG-INFO +4 -4
  3. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/pyproject.toml +5 -3
  4. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/requirements.txt +21 -21
  5. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/_version.py +2 -2
  6. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/adminlevel.py +2 -2
  7. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/test_adminlevel.py +1 -1
  8. hdx_python_country-3.8.5/src/hdx/location/phonetics.py +0 -56
  9. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.config/coveragerc +0 -0
  10. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.config/pytest.ini +0 -0
  11. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.config/ruff.toml +0 -0
  12. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.github/workflows/publish.yaml +0 -0
  13. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.github/workflows/run-python-tests.yaml +0 -0
  14. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/.gitignore +0 -0
  15. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/CONTRIBUTING.md +0 -0
  16. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/LICENSE +0 -0
  17. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/README.md +0 -0
  18. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/documentation/.readthedocs.yaml +0 -0
  19. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/documentation/main.md +0 -0
  20. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/documentation/pydoc-markdown.yaml +0 -0
  21. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
  22. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/__init__.py +0 -0
  23. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/country.py +0 -0
  24. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/currency.py +0 -0
  25. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/wfp_api.py +0 -0
  26. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/src/hdx/location/wfp_exchangerates.py +0 -0
  27. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/adminlevel.yaml +0 -0
  28. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/adminlevelparent.yaml +0 -0
  29. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/download-global-pcode-lengths.csv +0 -0
  30. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/download-global-pcodes-adm-1-2.csv +0 -0
  31. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/secondary_historic_rates.csv +0 -0
  32. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/secondary_rates.json +0 -0
  33. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_List_1.json +0 -0
  34. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_List_2.json +0 -0
  35. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_1.json +0 -0
  36. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_10.json +0 -0
  37. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_2.json +0 -0
  38. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_3.json +0 -0
  39. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_4.json +0 -0
  40. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_5.json +0 -0
  41. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_6.json +0 -0
  42. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_7.json +0 -0
  43. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_8.json +0 -0
  44. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/fixtures/wfp/Currency_UsdIndirectQuotation_9.json +0 -0
  45. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
  46. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/__init__.py +0 -0
  47. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/test_country.py +0 -0
  48. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/test_currency.py +0 -0
  49. {hdx_python_country-3.8.5 → hdx_python_country-3.8.6}/tests/hdx/location/test_wfp_exchangerates.py +0 -0
@@ -8,7 +8,7 @@ repos:
8
8
  - id: end-of-file-fixer
9
9
  - id: check-ast
10
10
  - repo: https://github.com/astral-sh/ruff-pre-commit
11
- rev: v0.7.0
11
+ rev: v0.8.6
12
12
  hooks:
13
13
  # Run the linter.
14
14
  - id: ruff
@@ -17,7 +17,7 @@ repos:
17
17
  - id: ruff-format
18
18
  args: [--config, .config/ruff.toml]
19
19
  - repo: https://github.com/astral-sh/uv-pre-commit
20
- rev: 0.4.24
20
+ rev: 0.5.15
21
21
  hooks:
22
22
  # Run the pip compile
23
23
  - id: pip-compile
@@ -1,10 +1,11 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: hdx-python-country
3
- Version: 3.8.5
3
+ Version: 3.8.6
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
7
7
  License: MIT
8
+ License-File: LICENSE
8
9
  Keywords: HDX,country,country code,currencies,currency,exchange rate,foreign exchange,fx,iso 3166,iso2,iso3,location,region
9
10
  Classifier: Development Status :: 5 - Production/Stable
10
11
  Classifier: Intended Audience :: Developers
@@ -24,9 +25,8 @@ Classifier: Programming Language :: Python :: 3.11
24
25
  Classifier: Programming Language :: Python :: 3.12
25
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
26
27
  Requires-Python: >=3.8
27
- Requires-Dist: hdx-python-utilities>=3.7.4
28
+ Requires-Dist: hdx-python-utilities>=3.8.0
28
29
  Requires-Dist: libhxl>=5.2.2
29
- Requires-Dist: pyphonetics
30
30
  Requires-Dist: tenacity
31
31
  Provides-Extra: dev
32
32
  Requires-Dist: pre-commit; extra == 'dev'
@@ -34,9 +34,8 @@ classifiers = [
34
34
  requires-python = ">=3.8"
35
35
 
36
36
  dependencies = [
37
- "hdx-python-utilities>=3.7.4",
37
+ "hdx-python-utilities>=3.8.0",
38
38
  "libhxl>=5.2.2",
39
- "pyphonetics",
40
39
  "tenacity",
41
40
  ]
42
41
  dynamic = ["version"]
@@ -65,6 +64,9 @@ packages = ["src/hdx"]
65
64
  [tool.hatch.build.hooks.vcs]
66
65
  version-file = "src/hdx/location/_version.py"
67
66
 
67
+ [tool.hatch.metadata]
68
+ allow-direct-references = true
69
+
68
70
  # Versioning
69
71
 
70
72
  [tool.hatch.version]
@@ -90,7 +92,7 @@ run = """
90
92
  """
91
93
 
92
94
  [tool.hatch.envs.hatch-static-analysis]
93
- dependencies = ["ruff==0.7.0"]
95
+ dependencies = ["ruff==0.8.6"]
94
96
 
95
97
  [tool.hatch.envs.hatch-static-analysis.scripts]
96
98
  format-check = ["ruff format --config .config/ruff.toml --check --diff {args:.}",]
@@ -2,23 +2,23 @@
2
2
  # uv pip compile pyproject.toml --resolver=backtracking --all-extras -o requirements.txt
3
3
  annotated-types==0.7.0
4
4
  # via pydantic
5
- attrs==24.2.0
5
+ attrs==24.3.0
6
6
  # via
7
7
  # frictionless
8
8
  # jsonlines
9
9
  # jsonschema
10
10
  # referencing
11
- certifi==2024.8.30
11
+ certifi==2024.12.14
12
12
  # via requests
13
13
  cfgv==3.4.0
14
14
  # via pre-commit
15
15
  chardet==5.2.0
16
16
  # via frictionless
17
- charset-normalizer==3.4.0
17
+ charset-normalizer==3.4.1
18
18
  # via requests
19
- click==8.1.7
19
+ click==8.1.8
20
20
  # via typer
21
- coverage==7.6.7
21
+ coverage==7.6.10
22
22
  # via pytest-cov
23
23
  distlib==0.3.9
24
24
  # via virtualenv
@@ -28,11 +28,11 @@ filelock==3.16.1
28
28
  # via virtualenv
29
29
  frictionless==5.18.0
30
30
  # via hdx-python-utilities
31
- hdx-python-utilities==3.7.4
31
+ hdx-python-utilities==3.8.0
32
32
  # via hdx-python-country (pyproject.toml)
33
33
  humanize==4.11.0
34
34
  # via frictionless
35
- identify==2.6.2
35
+ identify==2.6.5
36
36
  # via pre-commit
37
37
  idna==3.10
38
38
  # via requests
@@ -42,7 +42,7 @@ iniconfig==2.0.0
42
42
  # via pytest
43
43
  isodate==0.7.2
44
44
  # via frictionless
45
- jinja2==3.1.4
45
+ jinja2==3.1.5
46
46
  # via frictionless
47
47
  jsonlines==4.0.0
48
48
  # via hdx-python-utilities
@@ -56,7 +56,7 @@ jsonschema-specifications==2024.10.1
56
56
  # via jsonschema
57
57
  libhxl==5.2.2
58
58
  # via hdx-python-country (pyproject.toml)
59
- loguru==0.7.2
59
+ loguru==0.7.3
60
60
  # via hdx-python-utilities
61
61
  markdown-it-py==3.0.0
62
62
  # via rich
@@ -84,15 +84,15 @@ ply==3.11
84
84
  # libhxl
85
85
  pre-commit==4.0.1
86
86
  # via hdx-python-country (pyproject.toml)
87
- pydantic==2.9.2
87
+ pydantic==2.10.5
88
88
  # via frictionless
89
- pydantic-core==2.23.4
89
+ pydantic-core==2.27.2
90
90
  # via pydantic
91
- pygments==2.18.0
91
+ pygments==2.19.1
92
92
  # via rich
93
93
  pyphonetics==0.5.3
94
- # via hdx-python-country (pyproject.toml)
95
- pytest==8.3.3
94
+ # via hdx-python-utilities
95
+ pytest==8.3.4
96
96
  # via
97
97
  # hdx-python-country (pyproject.toml)
98
98
  # pytest-cov
@@ -129,11 +129,11 @@ rfc3986==2.0.0
129
129
  # via frictionless
130
130
  rich==13.9.4
131
131
  # via typer
132
- rpds-py==0.21.0
132
+ rpds-py==0.22.3
133
133
  # via
134
134
  # jsonschema
135
135
  # referencing
136
- ruamel-yaml==0.18.6
136
+ ruamel-yaml==0.18.10
137
137
  # via hdx-python-utilities
138
138
  ruamel-yaml-clib==0.2.12
139
139
  # via ruamel-yaml
@@ -141,7 +141,7 @@ shellingham==1.5.4
141
141
  # via typer
142
142
  simpleeval==1.0.3
143
143
  # via frictionless
144
- six==1.16.0
144
+ six==1.17.0
145
145
  # via python-dateutil
146
146
  stringcase==1.2.0
147
147
  # via frictionless
@@ -155,7 +155,7 @@ tenacity==9.0.0
155
155
  # via hdx-python-country (pyproject.toml)
156
156
  text-unidecode==1.3
157
157
  # via python-slugify
158
- typer==0.13.1
158
+ typer==0.15.1
159
159
  # via frictionless
160
160
  typing-extensions==4.12.2
161
161
  # via
@@ -167,15 +167,15 @@ unidecode==1.3.8
167
167
  # via
168
168
  # libhxl
169
169
  # pyphonetics
170
- urllib3==2.2.3
170
+ urllib3==2.3.0
171
171
  # via
172
172
  # libhxl
173
173
  # requests
174
174
  validators==0.34.0
175
175
  # via frictionless
176
- virtualenv==20.27.1
176
+ virtualenv==20.28.1
177
177
  # via pre-commit
178
- wheel==0.45.0
178
+ wheel==0.45.1
179
179
  # via libhxl
180
180
  xlrd==2.0.1
181
181
  # via hdx-python-utilities
@@ -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.5'
16
- __version_tuple__ = version_tuple = (3, 8, 5)
15
+ __version__ = version = '3.8.6'
16
+ __version_tuple__ = version_tuple = (3, 8, 6)
@@ -7,11 +7,11 @@ from hxl import InputOptions
7
7
  from hxl.input import HXLIOException
8
8
 
9
9
  from hdx.location.country import Country
10
- from hdx.location.phonetics import Phonetics
11
10
  from hdx.utilities.base_downloader import DownloadError
12
11
  from hdx.utilities.dictandlist import dict_of_sets_add
12
+ from hdx.utilities.matching import Phonetics, multiple_replace
13
13
  from hdx.utilities.retriever import Retrieve
14
- from hdx.utilities.text import multiple_replace, normalise
14
+ from hdx.utilities.text import normalise
15
15
  from hdx.utilities.typehint import ListTuple
16
16
 
17
17
  logger = logging.getLogger(__name__)
@@ -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()) == 2526
424
+ assert len(adminone.get_pcode_list()) == 2527
425
425
  assert adminone.get_pcode_length("YEM") == 4
426
426
  assert adminone.get_pcode("YEM", "YE30", logname="test") == (
427
427
  "YE30",
@@ -1,56 +0,0 @@
1
- from typing import Callable, Optional
2
-
3
- import pyphonetics
4
-
5
- from hdx.utilities.typehint import ListTuple
6
-
7
-
8
- class Phonetics(pyphonetics.RefinedSoundex):
9
- def match(
10
- self,
11
- possible_names: ListTuple,
12
- name: str,
13
- alternative_name: Optional[str] = None,
14
- transform_possible_names: ListTuple[Callable] = [],
15
- threshold: int = 2,
16
- ) -> Optional[int]:
17
- """
18
- Match name to one of the given possible names. Returns None if no match
19
- or the index of the matching name
20
-
21
- Args:
22
- possible_names (ListTuple): Possible names
23
- name (str): Name to match
24
- alternative_name (str): Alternative name to match. Defaults to None.
25
- transform_possible_names (ListTuple[Callable]): Functions to transform possible names.
26
- threshold: Match threshold. Defaults to 2.
27
-
28
- Returns:
29
- Optional[int]: Index of matching name from possible names or None
30
- """
31
- mindistance = None
32
- matching_index = None
33
-
34
- transform_possible_names.insert(0, lambda x: x)
35
-
36
- def check_name(name, possible_name):
37
- nonlocal mindistance, matching_index # noqa: E999
38
-
39
- distance = self.distance(name, possible_name)
40
- if mindistance is None or distance < mindistance:
41
- mindistance = distance
42
- matching_index = i
43
-
44
- for i, possible_name in enumerate(possible_names):
45
- for transform_possible_name in transform_possible_names:
46
- transformed_possible_name = transform_possible_name(
47
- possible_name
48
- )
49
- if not transformed_possible_name:
50
- continue
51
- check_name(name, transformed_possible_name)
52
- if alternative_name:
53
- check_name(alternative_name, transformed_possible_name)
54
- if mindistance is None or mindistance > threshold:
55
- return None
56
- return matching_index