Skip to content

Commit 139bf82

Browse files
committed
Delete unused function _wrap_compressed
1 parent 1b97d84 commit 139bf82

File tree

1 file changed

+0
-64
lines changed

1 file changed

+0
-64
lines changed

pandas/io/parsers.py

-64
Original file line numberDiff line numberDiff line change
@@ -1673,70 +1673,6 @@ def count_empty_vals(vals):
16731673
return sum([1 for v in vals if v == '' or v is None])
16741674

16751675

1676-
def _wrap_compressed(f, compression, encoding=None):
1677-
"""wraps compressed fileobject in a decompressing fileobject
1678-
NOTE: For all files in Python 3.2 and for bzip'd files under all Python
1679-
versions, this means reading in the entire file and then re-wrapping it in
1680-
StringIO.
1681-
"""
1682-
compression = compression.lower()
1683-
encoding = encoding or get_option('display.encoding')
1684-
1685-
if compression == 'gzip':
1686-
import gzip
1687-
1688-
f = gzip.GzipFile(fileobj=f)
1689-
if compat.PY3:
1690-
from io import TextIOWrapper
1691-
1692-
f = TextIOWrapper(f)
1693-
return f
1694-
elif compression == 'bz2':
1695-
import bz2
1696-
1697-
if compat.PY3:
1698-
f = bz2.open(f, 'rt', encoding=encoding)
1699-
else:
1700-
# Python 2's bz2 module can't take file objects, so have to
1701-
# run through decompress manually
1702-
data = bz2.decompress(f.read())
1703-
f = StringIO(data)
1704-
return f
1705-
elif compression == 'zip':
1706-
import zipfile
1707-
zip_file = zipfile.ZipFile(f)
1708-
zip_names = zip_file.namelist()
1709-
1710-
if len(zip_names) == 1:
1711-
file_name = zip_names.pop()
1712-
f = zip_file.open(file_name)
1713-
return f
1714-
1715-
elif len(zip_names) == 0:
1716-
raise ValueError('Corrupted or zero files found in compressed '
1717-
'zip file %s', zip_file.filename)
1718-
1719-
else:
1720-
raise ValueError('Multiple files found in compressed '
1721-
'zip file %s', str(zip_names))
1722-
1723-
elif compression == 'xz':
1724-
1725-
lzma = compat.import_lzma()
1726-
f = lzma.LZMAFile(f)
1727-
1728-
if compat.PY3:
1729-
from io import TextIOWrapper
1730-
1731-
f = TextIOWrapper(f)
1732-
1733-
return f
1734-
1735-
else:
1736-
raise ValueError('do not recognize compression method %s'
1737-
% compression)
1738-
1739-
17401676
class PythonParser(ParserBase):
17411677

17421678
def __init__(self, f, **kwds):

0 commit comments

Comments
 (0)