Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
sl-solution committed Jul 3, 2022
1 parent 8d1e25f commit 51846bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
3 changes: 0 additions & 3 deletions src/parse_io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,8 @@ function _process_iobuff_parse!(res::Vector{<:AbstractVector},
if anything_is_wrong == 1
# we split track_problems to two components - now track_problems_1 and track_problems_2 are vector rather than any
change_true_tracker!(track_problems_1::BitVector, j)
# track_problems[1][j] = true
if current_loc_track_problems < 21
change_loc_tracker!(track_problems_2::Vector{UnitRange{Int}}, current_loc_track_problems, cc, en)
# track_problems[2][current_loc_track_problems] = (new_lo == 0 ? field_start : new_lo):(new_hi == 0 ? dlm_pos - dlm_length : new_hi)
current_loc_track_problems += 1
end
end
Expand Down Expand Up @@ -487,7 +485,6 @@ function _process_iobuff_multiobs_parse!(res::Vector{<:AbstractVector},
end
j = j+1
if j > n_cols
# map(x->push!(x, missing), res)
for cols in 1:length(res)
push!(res[cols], missing)
end
Expand Down
5 changes: 2 additions & 3 deletions src/reader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function filereader(path::Union{AbstractString, IOBuffer}; opts...)
if header
l_length, start_of_file = read_one_line(path, start_of_file+1, FILESIZE(path), linebreak)
end
#by default, we switch to fast path when file size about 64MB or less
#by default, we switch to fast path when file size is about 64MB or less
small_size = get(optsd, :threshold, 2^26)
@assert small_size < 4294967295 "the `threshold` must be less than 4GB"
if FILESIZE(path) - start_of_file + 1 < small_size
Expand Down Expand Up @@ -330,7 +330,7 @@ end

if !eof(f) && cur_position < hi
if buffer.data[end] !== eol_last || buffer.data[end-eol_len+1] !== eol_first
#this means the buffer is not ended with an eol char, so we move back in buffer to have complete line
#this means the buffer is not ended with the eol char(s), so we move back to have a complete line
back_cnt = 0
for i in buffsize:-1:1
last_valid_buff = i
Expand Down Expand Up @@ -430,7 +430,6 @@ end

if !eof(f) && cur_position < hi
if buffer.data[end] !== eol_last || buffer.data[end-eol_len+1] !== eol_first
#this means the buffer is not ended with a eol char, so we move back into buffer to have complete line
back_cnt = 0
for i in buffsize:-1:1
last_valid_buff = i
Expand Down
8 changes: 4 additions & 4 deletions src/util.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Base.show(io::IO, ::MIME"text/plain", err::DLMERRORS_PARSE_ERROR) = show(IOConte
Base.show(io::IO, ::MIME"text/plain", err::DLMERRORS_LINE) = show(IOContext(io, :limit => true), "text/plain", err.message)

@noinline function PRINT_ERROR_TYPES_COLUMNS(x::Int, y::Int)::String
string("Number of columns ", x, " and number of column names ", y, " are not equal")
string("Number of columns ", x, " and number of column names ", y, " are not matched")
end
@noinline function PRINT_ERROR_LINEBREAK(linebreak::Vector{UInt8})::String
string("It is difficult to reach end of lines, either linebreak (current value : ", Char.(linebreak), ") is not detected properly or `lsize` and/or `buffsize` are too small.")
Expand Down Expand Up @@ -218,7 +218,7 @@ end
end
end
CLOSE(f)
throw(ArgumentError("end of line is not detectable, set `linebreak` argument manually"))
throw(ArgumentError("end of line is not detectable, set the `linebreak` argument manually"))
end


Expand Down Expand Up @@ -768,7 +768,7 @@ end
push!(colnames, Symbol("NONAME"*string(cnter)))
cnter += 1
else
throw(ArgumentError("the column name inference is not valid, if the table is very wide, increase `buffsize` and `lsize`, otherwise, setting `header = false` or `emptycolname = true` may solve the issue."))
throw(ArgumentError("the column name inference is not valid, if the file is very wide, increase `buffsize` and `lsize`, otherwise, setting `header = false` or `emptycolname = true` may resolve the issue."))
end
else
newsub = STRIP!(_SUBSTRING_(buffer, res[1,i][1]:res[1,i][2]))
Expand All @@ -777,7 +777,7 @@ end
push!(colnames, Symbol("NONAME"*string(cnter)))
cnter += 1
else
throw(ArgumentError("the column name inference is not valid, if the table is very wide, increase `buffsize` and `lsize`, otherwise, setting `header = false` or `emptycolname = true` may solve the issue."))
throw(ArgumentError("the column name inference is not valid, if the file is very wide, increase `buffsize` and `lsize`, otherwise, setting `header = false` or `emptycolname = true` may resolve the issue."))
end
else
push!(colnames, Create_Symbol(newsub.string.data, newsub.lo, newsub.hi))
Expand Down

0 comments on commit 51846bc

Please sign in to comment.