Skip to content

Commit

Permalink
Merge pull request #1341 from JuliaData/anj/gzip
Browse files Browse the repository at this point in the history
Unbreak deprecated readtable(GZip)
  • Loading branch information
andreasnoack authored Jan 8, 2018
2 parents 94b6d4c + ac58933 commit 9c0b802
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1050,45 +1050,45 @@ function readtable(pathname::AbstractString;
Base.depwarn("readtable is deprecated, use CSV.read from the CSV package instead",
:readtable)

_r(io) = readtable(io,
nbytes,
header = header,
separator = separator,
quotemark = quotemark,
decimal = decimal,
nastrings = nastrings,
truestrings = truestrings,
falsestrings = falsestrings,
makefactors = makefactors,
nrows = nrows,
names = names,
eltypes = eltypes,
allowcomments = allowcomments,
commentmark = commentmark,
ignorepadding = ignorepadding,
skipstart = skipstart,
skiprows = skiprows,
skipblanks = skipblanks,
encoding = encoding,
allowescapes = allowescapes,
normalizenames = normalizenames)

# Open an IO stream based on pathname
# (1) Path is an HTTP or FTP URL
if startswith(pathname, "http://") || startswith(pathname, "ftp://")
error("URL retrieval not yet implemented")
# (2) Path is GZip file
elseif endswith(pathname, ".gz")
io = gzopen(pathname, "r")
nbytes = 2 * filesize(pathname)
io = open(_r, GzipDecompressorStream, pathname, "r")
# (3) Path is BZip2 file
elseif endswith(pathname, ".bz") || endswith(pathname, ".bz2")
error("BZip2 decompression not yet implemented")
# (4) Path is an uncompressed file
else
io = open(pathname, "r")
nbytes = filesize(pathname)
io = open(_r, pathname, "r")
end

return readtable(io,
nbytes,
header = header,
separator = separator,
quotemark = quotemark,
decimal = decimal,
nastrings = nastrings,
truestrings = truestrings,
falsestrings = falsestrings,
makefactors = makefactors,
nrows = nrows,
names = names,
eltypes = eltypes,
allowcomments = allowcomments,
commentmark = commentmark,
ignorepadding = ignorepadding,
skipstart = skipstart,
skiprows = skiprows,
skipblanks = skipblanks,
encoding = encoding,
allowescapes = allowescapes,
normalizenames = normalizenames)
end

"""
Expand Down

0 comments on commit 9c0b802

Please sign in to comment.