hdx-python-country 3.7.6__tar.gz → 3.7.7__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 (37) hide show
  1. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.config/pre-commit-config.yaml +2 -2
  2. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/PKG-INFO +1 -1
  3. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/requirements.txt +7 -7
  4. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/_version.py +2 -2
  5. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/adminlevel.py +10 -4
  6. hdx_python_country-3.7.7/tests/fixtures/global_pcode_lengths.csv +158 -0
  7. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/fixtures/global_pcodes_adm_1_2.csv +1926 -3743
  8. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/hdx/location/test_adminlevel.py +25 -13
  9. hdx_python_country-3.7.6/tests/fixtures/global_pcode_lengths.csv +0 -159
  10. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.config/coveragerc +0 -0
  11. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.config/pytest.ini +0 -0
  12. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.config/ruff.toml +0 -0
  13. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.github/workflows/publish.yaml +0 -0
  14. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.github/workflows/run-python-tests.yaml +0 -0
  15. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/.gitignore +0 -0
  16. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/CONTRIBUTING.md +0 -0
  17. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/LICENSE +0 -0
  18. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/README.md +0 -0
  19. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/documentation/.readthedocs.yaml +0 -0
  20. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/documentation/main.md +0 -0
  21. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/documentation/pydoc-markdown.yaml +0 -0
  22. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/pyproject.toml +0 -0
  23. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/Countries & Territories Taxonomy MVP - C&T Taxonomy with HXL Tags.csv +0 -0
  24. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/__init__.py +0 -0
  25. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/country.py +0 -0
  26. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/currency.py +0 -0
  27. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/phonetics.py +0 -0
  28. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/src/hdx/location/wfp_exchangerates.py +0 -0
  29. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/fixtures/adminlevel.yaml +0 -0
  30. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/fixtures/adminlevelparent.yaml +0 -0
  31. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/fixtures/secondary_historic_rates.csv +0 -0
  32. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/fixtures/secondary_rates.json +0 -0
  33. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/hdx/location/Countries_UZB_Deleted.csv +0 -0
  34. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/hdx/location/__init__.py +0 -0
  35. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/hdx/location/test_country.py +0 -0
  36. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/tests/hdx/location/test_currency.py +0 -0
  37. {hdx_python_country-3.7.6 → hdx_python_country-3.7.7}/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.4.8
11
+ rev: v0.5.1
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.2.10
20
+ rev: 0.2.13
21
21
  hooks:
22
22
  # Run the pip compile
23
23
  - id: pip-compile
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hdx-python-country
3
- Version: 3.7.6
3
+ Version: 3.7.7
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
@@ -18,7 +18,7 @@ charset-normalizer==3.3.2
18
18
  # via requests
19
19
  click==8.1.7
20
20
  # via typer
21
- coverage==7.5.4
21
+ coverage==7.6.0
22
22
  # via pytest-cov
23
23
  distlib==0.3.8
24
24
  # via virtualenv
@@ -30,7 +30,7 @@ frictionless==5.17.0
30
30
  # via hdx-python-utilities
31
31
  hdx-python-utilities==3.7.2
32
32
  # via hdx-python-country (pyproject.toml)
33
- humanize==4.9.0
33
+ humanize==4.10.0
34
34
  # via frictionless
35
35
  identify==2.6.0
36
36
  # via pre-commit
@@ -48,7 +48,7 @@ jsonlines==4.0.0
48
48
  # via hdx-python-utilities
49
49
  jsonpath-ng==1.6.1
50
50
  # via libhxl
51
- jsonschema==4.22.0
51
+ jsonschema==4.23.0
52
52
  # via
53
53
  # frictionless
54
54
  # tableschema-to-template
@@ -92,7 +92,7 @@ pygments==2.18.0
92
92
  # via rich
93
93
  pyphonetics==0.5.3
94
94
  # via hdx-python-country (pyproject.toml)
95
- pytest==8.2.2
95
+ pytest==8.3.1
96
96
  # via
97
97
  # hdx-python-country (pyproject.toml)
98
98
  # pytest-cov
@@ -129,7 +129,7 @@ rfc3986==2.0.0
129
129
  # via frictionless
130
130
  rich==13.7.1
131
131
  # via typer
132
- rpds-py==0.18.1
132
+ rpds-py==0.19.0
133
133
  # via
134
134
  # jsonschema
135
135
  # referencing
@@ -147,7 +147,7 @@ six==1.16.0
147
147
  # python-dateutil
148
148
  stringcase==1.2.0
149
149
  # via frictionless
150
- structlog==24.2.0
150
+ structlog==24.4.0
151
151
  # via libhxl
152
152
  tableschema-to-template==0.0.13
153
153
  # via hdx-python-utilities
@@ -171,7 +171,7 @@ urllib3==2.2.2
171
171
  # via
172
172
  # libhxl
173
173
  # requests
174
- validators==0.30.0
174
+ validators==0.33.0
175
175
  # via frictionless
176
176
  virtualenv==20.26.3
177
177
  # via pre-commit
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.7.6'
16
- __version_tuple__ = version_tuple = (3, 7, 6)
15
+ __version__ = version = '3.7.7'
16
+ __version_tuple__ = version_tuple = (3, 7, 7)
@@ -125,7 +125,7 @@ class AdminLevel:
125
125
  self,
126
126
  countryiso3: str,
127
127
  pcode: str,
128
- adm_name: str,
128
+ adm_name: Optional[str],
129
129
  parent: Optional[str],
130
130
  ):
131
131
  """
@@ -134,7 +134,7 @@ class AdminLevel:
134
134
  Args:
135
135
  countryiso3 (str): Country
136
136
  pcode (str): P-code
137
- adm_name (str): Administrative name
137
+ adm_name (Optional[str]): Administrative name (which can be None)
138
138
  parent (Optional[str]): Parent p-code
139
139
 
140
140
  Returns:
@@ -142,14 +142,20 @@ class AdminLevel:
142
142
  """
143
143
  self.pcode_lengths[countryiso3] = len(pcode)
144
144
  self.pcodes.append(pcode)
145
+ if adm_name is None:
146
+ adm_name = ""
145
147
  self.pcode_to_name[pcode] = adm_name
148
+ self.pcode_to_iso3[pcode] = countryiso3
149
+ if not adm_name:
150
+ logger.error(
151
+ f"Admin name is blank for pcode {pcode} of {countryiso3}!"
152
+ )
153
+ return
146
154
 
147
155
  adm_name = normalise(adm_name)
148
156
  name_to_pcode = self.name_to_pcode.get(countryiso3, {})
149
157
  name_to_pcode[adm_name] = pcode
150
158
  self.name_to_pcode[countryiso3] = name_to_pcode
151
- self.pcode_to_iso3[pcode] = countryiso3
152
- self.pcode_to_iso3[pcode] = countryiso3
153
159
 
154
160
  if self.use_parent:
155
161
  name_parent_to_pcode = self.name_parent_to_pcode.get(
@@ -0,0 +1,158 @@
1
+ Location,Country Length,Admin 1 Length,Admin 2 Length,Admin 3 Length,Admin 4 Length,Admin 5 Length
2
+ #country+code,#country+len,#adm1+len,#adm2+len,#adm3+len,#adm4+len,#adm5+len
3
+ AFG,2,2,2,,,
4
+ AGO,2,2,3,3,,
5
+ ALB,2,2,2,2,,
6
+ ARE,2,2,,,,
7
+ ARG,2,3,3,,,
8
+ ARM,2,2,1,3,,
9
+ ATG,2,2,,,,
10
+ AZE,2,8,,,,
11
+ BDI,3,3,3,,,
12
+ BEN,2,2,2,,,
13
+ BES,3,1,,,,
14
+ BFA,2,2,2,2,,
15
+ BGD,2,2,2,2,2,
16
+ BGR,2,3,3,,,
17
+ BLR,2,3,3,,,
18
+ BLZ,2,2,,,,
19
+ BMU,2,2,1,,,
20
+ BOL,2,2,2,2,,
21
+ BRA,2,2,5,,,
22
+ BRB,2,2,,,,
23
+ BTN,2,3,2,,,
24
+ BWA,2,2,2,2,,
25
+ CAF,2,2,1,1,2,
26
+ CHL,2,2,1,2,,
27
+ CHN,2,3,3,,,
28
+ CIV,2,2,2,2,,
29
+ CMR,2,3,3,3,,
30
+ COD,2,2,2,,,
31
+ COG,2,2,2,,,
32
+ COL,2,2,3,,,
33
+ COM,2,1,1,1,,
34
+ CPV,2,2,2,,,
35
+ CRI,2,1,2,2,,
36
+ CUB,2,2,2,,,
37
+ CUW,2,2,,,,
38
+ CYM,2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+ MWI,2,1,2,2,,
98
+ MYS,2,2,2,,,
99
+ NAM,2,2,2,,,
100
+ NER,2,3,3,3,,
101
+ NGA,2,3,3,3,,
102
+ NIC,2,2,2,,,
103
+ NPL,2,2,2,3,,
104
+ OMN,2,2,2,,,
105
+ PAK,2,1,2,2,,
106
+ PAN,2,2,2,2,,
107
+ PER,2,2,2,2,,
108
+ PHL,2,2,3,2,3,
109
+ PNG,2,2,2,2,,
110
+ POL,2,3,3,,,
111
+ PRI,2,2,,,,
112
+ PRK,2,2,2,,,
113
+ PRY,2,2,2,,,
114
+ PSE,2,2,2,,,
115
+ QAT,3,3,3,,,
116
+ ROU,2,3,3,,,
117
+ RUS,2,3,3,,,
118
+ RWA,2,1,1,2,2,
119
+ SAU,2,2,,,,
120
+ SDN,2,2,3,,,
121
+ SEN,2,2,2,2,,
122
+ SLB,2,2,4,4,,
123
+ SLE,2,2,2,2,2,
124
+ SLV,2,2,2,,,
125
+ SOM,2,2,2,,,
126
+ SSD,2,2,2,2,,
127
+ STP,2,2,2,,,
128
+ SUR,2,2,2,,,
129
+ SVK,2,3,3,,,
130
+ SWZ,2,1,2,,,
131
+ SXM,2,1,,,,
132
+ SYC,2,1,1,4,,
133
+ SYR,2,2,2,2,,
134
+ TCA,2,1,2,,,
135
+ TCD,2,2,2,2,,
136
+ TGO,2,2,2,2,,
137
+ THA,2,2,2,2,,
138
+ TJK,0,7,0,,,
139
+ TLS,2,2,2,2,,
140
+ TON,2,1,1,2,,
141
+ TTO,2,2,,,,
142
+ TUN,2,1,1,2,2,
143
+ TUR,3,3,3,3,3,
144
+ TZA,2,2,2,3|4,,
145
+ UGA,2,1,3,2,2,
146
+ UKR,2,2,2,3,3,
147
+ URY,2,2,3,,,
148
+ UZB,2,2,3,,,
149
+ VCT,2,1,2,,,
150
+ VEN,2,2,2,2,,
151
+ VGB,2,2,,,,
152
+ VIR,2,3,5,,,
153
+ VNM,2,3,2,,,
154
+ VUT,2,2,3,,,
155
+ YEM,2,2,2,2,,
156
+ ZAF,2,1,2,1,3,
157
+ ZMB,2,3,3,3,3,
158
+ ZWE,2,2,2,2,,