Skip to content

Commit

Permalink
dataset: do not feed blank dict to csv.DictReader for no reason
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-wahl committed Feb 20, 2025
1 parent aa33afd commit 4940702
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/lib/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def _iterate_items(self, processor=None):
if path.suffix.lower() == ".csv":
with path.open("rb") as infile:
wrapped_infile = NullAwareTextIOWrapper(infile, encoding="utf-8")
reader = csv.DictReader(wrapped_infile, **csv_parameters)
reader = csv.DictReader(wrapped_infile)

if not self.get_own_processor():
# Processor was deprecated or removed; CSV file is likely readable but some legacy types are not
Expand Down Expand Up @@ -630,7 +630,7 @@ def is_rankable(self, multiple_items=True):
column_options.add("word_1")

with self.get_results_path().open(encoding="utf-8") as infile:
reader = csv.DictReader(infile, {})
reader = csv.DictReader(infile)
try:
return len(set(reader.fieldnames) & column_options) >= 3
except (TypeError, ValueError):
Expand Down

0 comments on commit 4940702

Please sign in to comment.