Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-mills committed Feb 13, 2025
1 parent f0a31e3 commit 7dfa819
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 79 deletions.
4 changes: 2 additions & 2 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ click==8.1.8
# via
# -c requirements.txt
# typer
coverage==7.6.11
coverage==7.6.12
# via pytest-cov
defopt==6.4.0
# via
Expand Down Expand Up @@ -157,7 +157,7 @@ num2words==0.5.14
# via
# -c requirements.txt
# quantulum3
numpy==2.2.2
numpy==2.2.3
# via
# -c requirements.txt
# pandas
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ more-itertools==10.6.0
# via inflect
num2words==0.5.14
# via quantulum3
numpy==2.2.2
numpy==2.2.3
# via pandas
openpyxl==3.1.5
# via hdx-python-utilities
Expand Down
10 changes: 3 additions & 7 deletions src/hdx/scraper/acled/acled.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,18 @@ def download_data(self, current_year: int) -> None:
end_dates.append(end_date)

# Fill in pcodes and names
warning = None
if admin_level == 0:
adm1_pcodes.append(None)
adm2_pcodes.append(None)
adm1_names.append(None)
adm2_names.append(None)
warnings.append(None)

warning = None
if admin_level == 2:
pcode = contents["Admin2 Pcode"][i]
admin2_name = contents["Admin2"][i]
if not pcode:
self._error_handler.add_missing_value_message(
"ACLED",
dataset_name,
f"admin {admin_level} pcode",
admin2_name,
)
warning = f"Missing pcode for {admin2_name}!"
elif pcode not in self._admins[1].pcodes:
matched_pcode = self._admins[1].convert_admin_pcode_length(
Expand Down Expand Up @@ -199,6 +194,7 @@ def download_data(self, current_year: int) -> None:
contents["admin2_code"] = adm2_pcodes
contents["admin1_name"] = adm1_names
contents["admin2_name"] = adm2_names
contents["warning"] = warnings

# Add fatalities column
if "Fatalities" not in headers:
Expand Down
Loading

0 comments on commit 7dfa819

Please sign in to comment.