Skip to content

Commit

Permalink
Make more generic admin code matching function that works with admin 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike committed Oct 31, 2023
1 parent 1dc80c6 commit 8eac94e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/hdx/location/adminlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,12 @@ def init_matches_errors(self) -> None:
def convert_admin_pcode_length(
self, countryiso3: str, pcode: str, logname: Optional[str] = None
) -> Optional[str]:
"""Standardise pcode length by country and match to an internal pcode
"""Standardise pcode length by country and match to an internal pcode.
Requires that p-code formats be loaded (eg. using load_pcode_formats)
Args:
countryiso3 (str): Iso3 country code
pcode (str): P code for admin one
countryiso3 (str): ISO3 country code
pcode (str): P code to match
logname (Optional[str]): Identifying name to use when logging. Defaults to None (don't log).
Returns:
Expand Down Expand Up @@ -350,12 +351,12 @@ def convert_admin_pcode_length(
def convert_admin1_pcode_length(
self, countryiso3: str, pcode: str, logname: Optional[str] = None
) -> Optional[str]:
"""Standardise pcode length by country and match to an internal pcode. Only
works for admin1 pcodes.
"""Standardise pcode length by country and match to an internal pcode.
Only works for admin1 pcodes.
Args:
countryiso3 (str): Iso3 country code
pcode (str): P code for admin one
countryiso3 (str): ISO3 country code
pcode (str): P code for admin one to match
logname (Optional[str]): Identifying name to use when logging. Defaults to None (don't log).
Returns:
Expand Down

0 comments on commit 8eac94e

Please sign in to comment.