Repository navigation
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.
Adds
csvformat --describeto inspect the effective input dialect, implementing the diagnostic-report direction suggested in #1011 (and #1282). For example,printf 'a;b\n1;2\n' | csvformat --describenow reportsDelimiter: ';', together with quote, escape, doublequote, quoting, and initial-space settings.The report uses agate's sniffer, honors explicit input overrides and skipped lines, and avoids parsing data rows.
-y/--snifflimitcontrols diagnostic sampling (1024 characters by default, 0 disables sniffing, -1 reads the full file). Normal conversion retains its existing behavior. Line terminators are omitted because Sniffer does not infer them. Documentation and regression coverage are included.Revalidation of the original long-row fixture: with current dependencies, both 10 and 100 rows complete under
csvstat's default limit with a sniffing warning and comma fallback. The new diagnostic with-y -1reports a space for the 100-row fixture, making the sampling difference inspectable. This PR does not change exception handling or add sample-size warnings.Validation on Python 3.12.14:
pytest tests/test_utilities/test_csvformat.py -q: 40 passed.pytest -q: 361 passed, 4 skipped, 31 subtests passed, 1 existing failure.TestCSVStat.test_decimal_formatexpects9,748.346but receives9748.346; the same failure was reproduced in a clean worktree at base commit6d19c625214977ab2988e674441ca24638bc12d3, without these changes.check-manifest, andgit diff --checkpassed.