Skip to content

Commit

Permalink
Merge pull request #6 from dan-knight/fix-csv-load
Browse files Browse the repository at this point in the history
Fix closed file bug in CSV loader
  • Loading branch information
dan-knight authored Feb 5, 2024
2 parents 45a1c71 + a091f09 commit 2a22572
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hiddenfb/utility/file_loader/csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ def load(self, path: Path) -> List[Dict[str, Any]]:
with self._load_file(path, file_type="csv") as f:
data = csv.reader(f)

header_columns: List[str] = self._parse_header(data)
header_columns: List[str] = self._parse_header(data)

return flatten([self._parse_row(row, header=header_columns) for row in data])
return flatten(
[self._parse_row(row, header=header_columns) for row in data]
)

def _parse_header(self, reader: Iterator[Any]) -> List[str]:
return next(reader)
Expand Down

0 comments on commit 2a22572

Please sign in to comment.