@@ -297,13 +297,15 @@ def __new__(cls, name, bases, attrs):
297297 for compression in Compression .all :
298298 for ext in newcls .EXTENSIONS :
299299 new_extensions .append (ext + compression )
300+ if sys .platform in ('darwin' , 'win32' ):
300301 # OSX file dialog doesn't support filtering on double
301302 # extensions (e.g. .csv.gz)
302303 # https://bugreports.qt.io/browse/QTBUG-38303
303304 # This is just here for OWFile that gets QFileDialog
304305 # filters from FileFormat.readers.keys()
305- if sys .platform == 'darwin' :
306- new_extensions .append (compression )
306+ # EDIT: Windows exhibit similar problems:
307+ # while .tab.gz works, .tab.xz and .tab.bz2 do not!
308+ new_extensions .append (compression )
307309 newcls .EXTENSIONS = tuple (new_extensions )
308310
309311 return newcls
@@ -911,21 +913,22 @@ class TabReader(CSVReader):
911913
912914class PickleReader (FileFormat ):
913915 """Reader for pickled Table objects"""
914- EXTENSIONS = ('.pickle ' , '.pkl ' )
916+ EXTENSIONS = ('.pkl ' , '.pickle ' )
915917 DESCRIPTION = 'Pickled Python object file'
918+ SUPPORT_COMPRESSED = True
916919 SUPPORT_SPARSE_DATA = True
917920
918921 def read (self ):
919- with open (self .filename , 'rb' ) as f :
922+ with self . open (self .filename , 'rb' ) as f :
920923 table = pickle .load (f )
921924 if not isinstance (table , Table ):
922925 raise TypeError ("file does not contain a data table" )
923926 else :
924927 return table
925928
926- @staticmethod
927- def write_file (filename , data ):
928- with open (filename , 'wb' ) as f :
929+ @classmethod
930+ def write_file (cls , filename , data ):
931+ with cls . open (filename , 'wb' ) as f :
929932 pickle .dump (data , f , pickle .HIGHEST_PROTOCOL )
930933
931934
0 commit comments