Skip to content

Commit

Permalink
fix list syntax for combining range and dict
Browse files Browse the repository at this point in the history
Can't provide range and single element in the same 'list' call, split them
  • Loading branch information
ThrawnCA authored Feb 9, 2024
1 parent b5b99c7 commit 7d97961
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ckanext/xloader/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def load_csv(csv_filepath, resource_id, mimetype='text/csv', logger=None):

# Get the list of rows to skip. The rows in the tabulator stream are
# numbered starting with 1.
skip_rows = list(range(1, header_offset + 1), {'type': 'preset', 'value': 'blank'})
skip_rows = list(range(1, header_offset + 1))
skip_rows.append({'type': 'preset', 'value': 'blank'})

# Get the delimiter used in the file
delimiter = stream.dialect.get('delimiter')
Expand Down Expand Up @@ -375,7 +376,8 @@ def load_table(table_filepath, resource_id, mimetype='text/csv', logger=None):

# Get the list of rows to skip. The rows in the tabulator stream are
# numbered starting with 1. We also want to skip the header row.
skip_rows = list(range(1, header_offset + 2), {'type': 'preset', 'value': 'blank'})
skip_rows = list(range(1, header_offset + 2))
skip_rows.append({'type': 'preset', 'value': 'blank'})

TYPES, TYPE_MAPPING = get_types()
types = type_guess(stream.sample[1:], types=TYPES, strict=True)
Expand Down

0 comments on commit 7d97961

Please sign in to comment.