Skip to content

Commit bb9c5ec

Browse files
committed
💚 pass the unit test
1 parent ee4b2b1 commit bb9c5ec

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

pyexcel_xlsbr/xlsbr.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(
2020
self.__auto_detect_int = auto_detect_int
2121
self.__auto_detect_float = auto_detect_float
2222
self.__auto_detect_datetime = auto_detect_datetime
23+
self._native_sheet = sheet
2324

2425
def row_iterator(self):
2526
return self._native_sheet.rows()
@@ -34,16 +35,17 @@ def __convert_cell(self, cell):
3435

3536
class XLSBBook(IReader):
3637
def __init__(self, file_name, file_type, **keywords):
37-
self._native_book = open_workbook(self._file_name)
38+
self._native_book = open_workbook(file_name)
39+
self._keywords = keywords
3840
self.content_array = []
39-
for sheet_index, sheet_name in enumerate(self._native_book.sheets):
41+
for sheet_index, sheet_name in enumerate(self._native_book.sheets, 1):
4042
sheet = self._native_book.get_sheet(sheet_index)
4143
self.content_array.append(NamedContent(sheet_name, sheet))
4244

43-
def read_sheet_by_index(self, sheet_index):
44-
sheet = self.content_array[sheet_index]
45-
return self.read_sheet(sheet)
46-
47-
def read_sheet(self, native_sheet):
45+
def read_sheet(self, sheet_index):
46+
native_sheet = self.content_array[sheet_index].payload
4847
sheet = XLSBSheet(native_sheet, **self._keywords)
49-
return {sheet.name: sheet.to_array()}
48+
return sheet
49+
50+
def close(self):
51+
self._native_book.close()

0 commit comments

Comments
 (0)