Skip to content

Commit

Permalink
Allow for set and other unsubscriptable data structures. (#53)
Browse files Browse the repository at this point in the history
* Attempt at fixing TypeError with newer versions of openpyxl (#52), thanks to @konstantin-lebejko

* Update changelog
  • Loading branch information
craiga authored Nov 10, 2024
1 parent d8107ca commit 42ad7d8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@


3 contributors
4 contributors
================================================================================

In alphabetical order:

* `Benoit Pierre <https://github.com/benoit-pierre>`_
* `Craig Anderson <https://github.com/craiga>`_
* `John Vandenberg <https://github.com/jayvdb>`_
* `Stephen J. Fuhry <https://github.com/fuhrysteve>`_
4 changes: 4 additions & 0 deletions changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: pyexcel-xlsx
organisation: pyexcel
releases:
- changes:
- action: Updated
details:
- 'Compatability with openpyxl 3.1.0 and later'
- changes:
- action: Updated
details:
Expand Down
2 changes: 1 addition & 1 deletion pyexcel_xlsx/xlsxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def __init__(self, sheet, **keywords):
self.max_column = 0
self.__sheet_max_row = sheet.max_row
self.__sheet_max_column = sheet.max_column
for ranges in sheet.merged_cells.ranges[:]:
for ranges in list(sheet.merged_cells.ranges)[:]:
merged_cells = MergedCell(ranges)
merged_cells.register_cells(self.__merged_cells)
if self.max_row < merged_cells.bottom_row():
Expand Down
2 changes: 1 addition & 1 deletion tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def test_reading_through_sheets(self):
expected = [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]]
assert data == expected
data = list(b["Sheet3"].rows())
expected = [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]
expected = [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]
assert data == expected
sheet3 = b["Sheet3"]
sheet3.name_columns_by_row(0)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_multiple_sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,6 @@ def _produce_ordered_dict():
data_dict.update({"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]]})
data_dict.update({"Sheet2": [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]]})
data_dict.update(
{"Sheet3": [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]}
{"Sheet3": [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]]}
)
return data_dict
8 changes: 4 additions & 4 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import os
from datetime import datetime, time
from datetime import time, datetime

from nose.tools import eq_
from pyexcel_xlsx import get_data
from pyexcel_io._compact import OrderedDict

from pyexcel_xlsx import get_data
from nose.tools import eq_


def test_reading():
data = get_data(
os.path.join("tests", "fixtures", "date_field.xlsx"),
library="pyexcel-xlsx",
skip_hidden_row_and_column=False
skip_hidden_row_and_column=False,
)
expected = OrderedDict()
expected.update(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def test_write_book(self):
self.content = {
"Sheet1": [[1, 1, 1, 1], [2, 2, 2, 2], [3, 3, 3, 3]],
"Sheet2": [[4, 4, 4, 4], [5, 5, 5, 5], [6, 6, 6, 6]],
"Sheet3": [[u"X", u"Y", u"Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]],
"Sheet3": [["X", "Y", "Z"], [1, 4, 7], [2, 5, 8], [3, 6, 9]],
}
self.testfile = "writer.xlsx"
writer = Writer(self.testfile, "xlsx")
Expand Down

0 comments on commit 42ad7d8

Please sign in to comment.