Fix CSV sniffing samples truncated in the middle of a line - #140
Open
Voyagerroc-Lab wants to merge 1 commit into
Open
Fix CSV sniffing samples truncated in the middle of a line#140Voyagerroc-Lab wants to merge 1 commit into
Voyagerroc-Lab wants to merge 1 commit into
Conversation
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.
Piping a valid TSV with long rows into
rich - --csvcan exit withCould not determine delimiter: the 1,024-character sniffing sample ends partway through a row. This also affects comma, semicolon, and pipe delimiters.Sample the first 100 complete physical lines for both delimiter and header detection. This bounds the number of sampled lines while allowing fields longer than 1,024 characters. Rendering still consumes the full input, including rows beyond the sample and the existing head/tail selection.
Related to #54. This addresses truncated sampling;
csv.Snifferremains heuristic. #89 provides a separate manual dialect override and retains the truncated sample in its automatic path. The extension fallback from #39 remains covered by tests.Validation on Windows, Python 3.11.9, in a fresh virtual environment (
pip install -e . pytest click==8.1.8 black==22.3.0; Click 8.1 retains theFCalias used by the existing test):python -m pytest -q— 16 passed.pip check, andgit diff --checkpass.