def read(self, tsv_file):
"""
Reads the rows from the designated file using the configured fields.
Arguments:
tsv_file: a file-like object to read the data from
Returns:
records(list):
a list of the records cat to read_as_cls
"""
file_reader = csv.DictReader(
tsv_file,
**PEARSON_DIALECT_OPTIONS
)
valid_rows, invalid_rows = [], []
for row in file_reader:
try:
valid_rows.append(self.map_row(row))
except InvalidTsvRowException:
invalid_rows.append(row)
return (valid_rows, invalid_rows)
评论列表
文章目录