Skip to content

Commit

Permalink
🦺 Validate area input when normalizing locations
Browse files Browse the repository at this point in the history
  • Loading branch information
i-be-snek committed Oct 30, 2024
1 parent 58cfef9 commit c083f74
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Database/scr/normalize_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,13 @@ def normalize_locations(
try:
if area:
assert isinstance(area, str), f"Area is not a string: {area}"
if re.match(
"(country|location|area|adminarea|admin|admin_area|administrative area|administrative_area|none|null)(\s)*(s)*[0-9]*$",
area,
flags=re.IGNORECASE,
):
self.logger.error(f"Input area={area} type={type(area)} is not a valid area name")
return (None, None, None)
if in_country:
assert isinstance(in_country, str), f"Country is not a string: {in_country}"
assert not (
Expand Down

0 comments on commit c083f74

Please sign in to comment.