@@ -1748,70 +1748,6 @@ def count_empty_vals(vals):
1748
1748
return sum ([1 for v in vals if v == '' or v is None ])
1749
1749
1750
1750
1751
- def _wrap_compressed (f , compression , encoding = None ):
1752
- """wraps compressed fileobject in a decompressing fileobject
1753
- NOTE: For all files in Python 3.2 and for bzip'd files under all Python
1754
- versions, this means reading in the entire file and then re-wrapping it in
1755
- StringIO.
1756
- """
1757
- compression = compression .lower ()
1758
- encoding = encoding or get_option ('display.encoding' )
1759
-
1760
- if compression == 'gzip' :
1761
- import gzip
1762
-
1763
- f = gzip .GzipFile (fileobj = f )
1764
- if compat .PY3 :
1765
- from io import TextIOWrapper
1766
-
1767
- f = TextIOWrapper (f )
1768
- return f
1769
- elif compression == 'bz2' :
1770
- import bz2
1771
-
1772
- if compat .PY3 :
1773
- f = bz2 .open (f , 'rt' , encoding = encoding )
1774
- else :
1775
- # Python 2's bz2 module can't take file objects, so have to
1776
- # run through decompress manually
1777
- data = bz2 .decompress (f .read ())
1778
- f = StringIO (data )
1779
- return f
1780
- elif compression == 'zip' :
1781
- import zipfile
1782
- zip_file = zipfile .ZipFile (f )
1783
- zip_names = zip_file .namelist ()
1784
-
1785
- if len (zip_names ) == 1 :
1786
- file_name = zip_names .pop ()
1787
- f = zip_file .open (file_name )
1788
- return f
1789
-
1790
- elif len (zip_names ) == 0 :
1791
- raise ValueError ('Corrupted or zero files found in compressed '
1792
- 'zip file %s' , zip_file .filename )
1793
-
1794
- else :
1795
- raise ValueError ('Multiple files found in compressed '
1796
- 'zip file %s' , str (zip_names ))
1797
-
1798
- elif compression == 'xz' :
1799
-
1800
- lzma = compat .import_lzma ()
1801
- f = lzma .LZMAFile (f )
1802
-
1803
- if compat .PY3 :
1804
- from io import TextIOWrapper
1805
-
1806
- f = TextIOWrapper (f )
1807
-
1808
- return f
1809
-
1810
- else :
1811
- raise ValueError ('do not recognize compression method %s'
1812
- % compression )
1813
-
1814
-
1815
1751
class PythonParser (ParserBase ):
1816
1752
1817
1753
def __init__ (self , f , ** kwds ):
0 commit comments