From 51846bc77d7ed2d7c79ed74d0a6ff4e779bc8475 Mon Sep 17 00:00:00 2001 From: sl-solution Date: Sun, 3 Jul 2022 22:47:11 +1200 Subject: [PATCH] clean up --- src/parse_io.jl | 3 --- src/reader.jl | 5 ++--- src/util.jl | 8 ++++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/parse_io.jl b/src/parse_io.jl index 05d6a96..f941534 100644 --- a/src/parse_io.jl +++ b/src/parse_io.jl @@ -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 @@ -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 diff --git a/src/reader.jl b/src/reader.jl index 3f93f34..1fb821d 100644 --- a/src/reader.jl +++ b/src/reader.jl @@ -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 @@ -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 @@ -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 diff --git a/src/util.jl b/src/util.jl index f203180..a155635 100644 --- a/src/util.jl +++ b/src/util.jl @@ -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.") @@ -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 @@ -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])) @@ -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))