Closed
Conversation
This implements #522. It allows providing two different callbacks: * `invalidrow`: a callback that takes a single `Integer` representing the row number where an invalid state was detected (not enough columns parsed or more columns than expected were detected) * `invalidcell`: a callback called when an error occurs parsing a user-provided type (Int, Float64, Bool, Date, DateTime, or Time); the callback should take 5 arguments: 1) the type attempted while parsing, 2) a string of the cell where parsing failed, 3) a Parsers.jl `code` return code value that encodes events/states that occurred while parsing, 4) the row the invalid cell was on, and 5) the column the invalid cell was on. Providing an `invalidrow` or `invalidcell` function forces `silencewarnings=true` for invalid rows or cells, respectively, i.e. no warning will be printed if an error callback function is provided. If `strict=true` is provided, `invalidcell` will not be invoked. This PR includes a simple test, but no docs yet.
Codecov Report
@@ Coverage Diff @@
## master #618 +/- ##
==========================================
+ Coverage 82.83% 84.09% +1.25%
==========================================
Files 9 9
Lines 1643 1804 +161
==========================================
+ Hits 1361 1517 +156
- Misses 282 287 +5
Continue to review full report at Codecov.
|
Member
Author
|
Closing in favor of the approach in #656 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implements #522. It allows providing two different callbacks:
invalidrow: a callback that takes a singleIntegerrepresentingthe row number where an invalid state was detected (not enough columns
parsed or more columns than expected were detected)
invalidcell: a callback called when an error occurs parsing auser-provided type (Int, Float64, Bool, Date, DateTime, or Time); the
callback should take 5 arguments: 1) the type attempted while parsing,
codereturn code value that encodes events/states that occurred while
parsing, 4) the row the invalid cell was on, and 5) the column the
invalid cell was on.
Providing an
invalidroworinvalidcellfunction forcessilencewarnings=truefor invalid rows or cells, respectively, i.e. nowarning will be printed if an error callback function is provided.
If
strict=trueis provided,invalidcellwill not be invoked.This PR includes a simple test, but no docs yet.