Skip to content

Commit

Permalink
Merge branch 'main' into datetime-headings-error
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb authored Jul 4, 2024
2 parents 2ceae35 + 441dd52 commit 020bbf9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Don't error when there's a datetime in the header https://github.com/OpenDataServices/flatten-tool/issues/438

## [0.24.3]

### Fixed

- Ignore null characters in the input CSV file when reading configuration from the header rows
https://github.com/OpenDataServices/flatten-tool/pull/446

## [0.24.2] - 2024-06-12

### Fixed

- Rename `_get_column_letter` import to `get_colunmn_letter` for compatibility
with latest openpyxl
https://github.com/OpenDataServices/flatten-tool/issues/443

## [0.24.1] - 2024-02-09

### Fixed
Expand Down
20 changes: 10 additions & 10 deletions flattentool/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
except ImportError:
SHAPELY_AND_GEOJSON_LIBRARIES_AVAILABLE = False

from openpyxl.utils.cell import _get_column_letter
from openpyxl.utils.cell import get_column_letter

from flattentool.exceptions import DataErrorWarning
from flattentool.i18n import _
Expand Down Expand Up @@ -386,11 +386,11 @@ def do_unflatten(self):
actual_heading,
", ".join(
[
_get_column_letter(x + 1)
get_column_letter(x + 1)
for x in ignoring[:-1]
]
),
_get_column_letter(ignoring[-1] + 1),
get_column_letter(ignoring[-1] + 1),
sheet_name,
),
DataErrorWarning,
Expand All @@ -404,8 +404,8 @@ def do_unflatten(self):
)
).format(
actual_heading,
_get_column_letter(ignoring[0] + 1),
_get_column_letter(ignoring[1] + 1),
get_column_letter(ignoring[0] + 1),
get_column_letter(ignoring[1] + 1),
sheet_name,
),
DataErrorWarning,
Expand All @@ -419,7 +419,7 @@ def do_unflatten(self):
)
).format(
actual_heading,
_get_column_letter(ignoring[0] + 1),
get_column_letter(ignoring[0] + 1),
sheet_name,
),
DataErrorWarning,
Expand All @@ -445,7 +445,7 @@ def do_unflatten(self):
else:
cells[header] = Cell(
line[header],
(sheet_name, _get_column_letter(k + 1), j + 2, heading),
(sheet_name, get_column_letter(k + 1), j + 2, heading),
)
unflattened = unflatten_main_with_parser(
self.parser,
Expand Down Expand Up @@ -677,7 +677,7 @@ def get_sheet_configuration(self, sheet_name):
with open(
os.path.join(self.input_name, sheet_name + ".csv"), encoding=self.encoding
) as main_sheet_file:
r = csvreader(main_sheet_file)
r = csvreader(NullCharacterFilter(main_sheet_file))
heading_row = next(r)
if len(heading_row) > 0 and heading_row[0] == "#":
return heading_row[1:]
Expand Down Expand Up @@ -740,7 +740,7 @@ def get_sheet_headings(self, sheet_name):
if self.vertical_orientation:
return [
cell.value
for cell in worksheet[_get_column_letter(skip_rows + 1)][
for cell in worksheet[get_column_letter(skip_rows + 1)][
configuration_line:
]
]
Expand Down Expand Up @@ -777,7 +777,7 @@ def get_sheet_lines(self, sheet_name):

worksheet = self.workbook[self.sheet_names_map[sheet_name]]
if self.vertical_orientation:
header_row = worksheet[_get_column_letter(skip_rows + 1)]
header_row = worksheet[get_column_letter(skip_rows + 1)]
remaining_rows = worksheet.iter_cols(min_col=skip_rows + header_rows + 1)
if configuration_line:
header_row = header_row[1:]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def run(self):

setup(
name="flattentool",
version="0.24.1",
version="0.24.2",
author="Open Data Services",
author_email="[email protected]",
packages=["flattentool"],
Expand Down

0 comments on commit 020bbf9

Please sign in to comment.