@@ -1771,70 +1771,6 @@ def count_empty_vals(vals):
1771
1771
return sum ([1 for v in vals if v == '' or v is None ])
1772
1772
1773
1773
1774
- def _wrap_compressed (f , compression , encoding = None ):
1775
- """wraps compressed fileobject in a decompressing fileobject
1776
- NOTE: For all files in Python 3.2 and for bzip'd files under all Python
1777
- versions, this means reading in the entire file and then re-wrapping it in
1778
- StringIO.
1779
- """
1780
- compression = compression .lower ()
1781
- encoding = encoding or get_option ('display.encoding' )
1782
-
1783
- if compression == 'gzip' :
1784
- import gzip
1785
-
1786
- f = gzip .GzipFile (fileobj = f )
1787
- if compat .PY3 :
1788
- from io import TextIOWrapper
1789
-
1790
- f = TextIOWrapper (f )
1791
- return f
1792
- elif compression == 'bz2' :
1793
- import bz2
1794
-
1795
- if compat .PY3 :
1796
- f = bz2 .open (f , 'rt' , encoding = encoding )
1797
- else :
1798
- # Python 2's bz2 module can't take file objects, so have to
1799
- # run through decompress manually
1800
- data = bz2 .decompress (f .read ())
1801
- f = StringIO (data )
1802
- return f
1803
- elif compression == 'zip' :
1804
- import zipfile
1805
- zip_file = zipfile .ZipFile (f )
1806
- zip_names = zip_file .namelist ()
1807
-
1808
- if len (zip_names ) == 1 :
1809
- file_name = zip_names .pop ()
1810
- f = zip_file .open (file_name )
1811
- return f
1812
-
1813
- elif len (zip_names ) == 0 :
1814
- raise ValueError ('Corrupted or zero files found in compressed '
1815
- 'zip file %s' , zip_file .filename )
1816
-
1817
- else :
1818
- raise ValueError ('Multiple files found in compressed '
1819
- 'zip file %s' , str (zip_names ))
1820
-
1821
- elif compression == 'xz' :
1822
-
1823
- lzma = compat .import_lzma ()
1824
- f = lzma .LZMAFile (f )
1825
-
1826
- if compat .PY3 :
1827
- from io import TextIOWrapper
1828
-
1829
- f = TextIOWrapper (f )
1830
-
1831
- return f
1832
-
1833
- else :
1834
- raise ValueError ('do not recognize compression method %s'
1835
- % compression )
1836
-
1837
-
1838
1774
class PythonParser (ParserBase ):
1839
1775
1840
1776
def __init__ (self , f , ** kwds ):
0 commit comments