@@ -106,7 +106,7 @@ def open_workbook(self, *args, **kwargs):
106
106
if isinstance (self ._open_workbook , type (None )):
107
107
self .load_engine ()
108
108
# just in case the user passes an already opened workbook of io_class
109
- if isinstance (args [0 ], self .io_class ):
109
+ if len ( args ) > 0 and isinstance (args [0 ], self .io_class ):
110
110
return args [0 ]
111
111
return self ._open_workbook (* args , ** kwargs )
112
112
@@ -122,14 +122,21 @@ def is_ext(self, path):
122
122
else :
123
123
return False
124
124
125
- def is_type (self , io ):
125
+ def is_type (self , io ):#, engine=None):
126
126
"""Verify if the io type is supported by the reader. If the reader is
127
127
not installed, return False.
128
128
"""
129
129
if isinstance (io , type (None )):
130
130
return False
131
131
elif isinstance (io , self .io_class ):
132
132
return True
133
+ # elif self.engine == engine:
134
+ # return True
135
+ # elif isinstance(io, compat.string_types):
136
+ # if self.is_ext(io):
137
+ # return True
138
+ # else:
139
+ # return False
133
140
else :
134
141
return False
135
142
@@ -164,6 +171,24 @@ def _load_engine(self):
164
171
self ._open_workbook = xlrd .open_workbook
165
172
self .io_class = xlrd .Book
166
173
174
+ # def open_workbook(self, *args, **kwargs):
175
+ # """Explicitely load the engine again (and trigger an ImportError in the
176
+ # process) if _open_workbook is set to None.
177
+ # """
178
+ # # try to load the engine again and raise import error if required
179
+ # if isinstance(self._open_workbook, type(None)):
180
+ # self.load_engine()
181
+ # io = args[0]
182
+ # # just in case the user passes an already opened workbook of io_class
183
+ # if isinstance(io, self.io_class):
184
+ # return io
185
+ # # N.B. xlrd.Book has a read attribute too
186
+ # elif hasattr(io, "read"):
187
+ # data = io.read()
188
+ # return self._open_workbook(file_contents=data)
189
+ #
190
+ # return self._open_workbook(*args, **kwargs)
191
+
167
192
168
193
class EZODFFile (BaseFile ):
169
194
"""File reader class for ODF spreadsheets (depends on ezodf)
0 commit comments