11from __future__ import annotations
22
3+ import codecs
34import enum
45import functools
56import io
1314
1415from refinery .lib .structures import MemoryFile
1516from refinery .lib .tools import NoLogging
16- from refinery .lib .types import Param
17+ from refinery .lib .types import buf , Param
1718from refinery .units import Arg , Unit
1819
1920if TYPE_CHECKING :
@@ -298,17 +299,12 @@ class xlxtr(ExcelUnit):
298299 """
299300 def __init__ (
300301 self ,
301- * references : Param [SheetReference , Arg (
302- metavar = 'reference' ,
303- type = SheetReference ,
304- help = (
305- 'A sheet reference to be extracted. '
306- 'If no sheet references are given, the unit lists all sheet names.'
307- )
308- )]
302+ * references : Param [buf , Arg (metavar = 'reference' , help = (
303+ 'A sheet reference to be extracted. '
304+ 'If no sheet references are given, the unit lists all sheet names.' ))]
309305 ):
310306 if not references :
311- references = SheetReference ( '*' ) ,
307+ references = b '*' ,
312308 super ().__init__ (references = references )
313309
314310 def process (self , data ):
@@ -318,8 +314,8 @@ def process(self, data):
318314 raise
319315 except Exception as E :
320316 raise ValueError ('Input not recognized as Excel document.' ) from E
321- for ref in self .args .references :
322- ref : SheetReference
317+ references = [ SheetReference ( codecs . decode ( r , self . codec )) for r in self .args .references ]
318+ for ref in references :
323319 for k , name in enumerate (wb .sheets ()):
324320 if not ref .match (k , name ):
325321 continue
0 commit comments