22from io import BytesIO
33
44import pyexcel_io .service as service
5- from pyexcel_io .plugin_api .abstract_reader import IReader
6- from pyexcel_io .plugin_api .abstract_sheet import ISheet
7-
5+ from pyexcel_io .plugin_api import IReader , ISheet , NamedContent
86from pyexcel_xlsxr .messy_xlsx import XLSXBookSet
97
108
@@ -15,20 +13,14 @@ def __init__(
1513 auto_detect_int = True ,
1614 auto_detect_float = True ,
1715 auto_detect_datetime = True ,
18- ** keywords
1916 ):
20- self ._native_sheet = sheet
17+ self .xlsx_sheet = sheet
2118 self .__auto_detect_int = auto_detect_int
2219 self .__auto_detect_float = auto_detect_float
2320 self .__auto_detect_datetime = auto_detect_datetime
24- self ._keywords = keywords
25-
26- @property
27- def name (self ):
28- return self ._native_sheet .name
2921
3022 def row_iterator (self ):
31- return self ._native_sheet .raw ()
23+ return self .xlsx_sheet .raw ()
3224
3325 def column_iterator (self , row ):
3426 for cell in row :
@@ -57,30 +49,24 @@ def __convert_cell(self, cell):
5749
5850class XLSXBook (IReader ):
5951 def __init__ (self , file_alike_object , _ , ** keywords ):
60- self ._native_book = XLSXBookSet (file_alike_object )
52+ self .xlsx_book = XLSXBookSet (file_alike_object )
6153 self ._keywords = keywords
62- tables = self ._native_book .make_tables ()
54+ tables = self .xlsx_book .make_tables ()
6355 self .content_array = [
64- NameObject (table .name , table ) for table in tables
56+ NameContent (table .name , table ) for table in tables
6557 ]
6658
6759 def read_sheet (self , sheet_index ):
6860 """read a sheet at a specified index"""
69- table = self .content_array [sheet_index ].sheet
61+ table = self .content_array [sheet_index ].payload
7062 sheet = XLSXSheet (table , ** self ._keywords )
7163 return sheet
7264
7365 def close (self ):
74- self ._native_book .close ()
66+ self .xlsx_book .close ()
7567
7668
7769class XLSXBookInContent (XLSXBook ):
7870 def __init__ (self , file_content , file_type , ** keywords ):
7971 file_stream = BytesIO (file_content )
8072 super ().__init__ (file_stream , file_type , ** keywords )
81-
82-
83- class NameObject (object ):
84- def __init__ (self , name , sheet ):
85- self .name = name
86- self .sheet = sheet
0 commit comments