GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-30825: guess lineterminator in csv.Sniffer by vmax · Pull Request #2529 · python/cpython Conversation
|
|
@vmax, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rhettinger, @benjaminp and @birkenfeld to be potential reviewers. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Patch needs tests.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Every '\r\n' will be counted as '\r' and '\n' as well as '\r\n'. So I believe the '\r\n' count should be subtracted from the other 2 before comparing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
@terryjreedy I changed detection method; most probably line terminators would be consistent so if one of them is present, it would be the one
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
To try and help move older pull requests forward, we are going through and backfilling 'awaiting' labels on pull requests that are lacking the label. Based on the current reviews, the best we can tell in an automated fashion is that a core developer requested changes to be made to this pull request. If/when the requested changes have been made, please leave a comment that says, |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Revise new test as suggested. Subject to more review, the code change looks good to me.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| for terminator in terminators: | ||
| if terminator in sample: | ||
| return terminator |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is the core of the patch. The sequence looks right.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if terminator in sample: | ||
| return terminator | ||
|
|
||
| return os.linesep |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
In case user submits a sample with an unusual or no line terminator.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 'Tommy''s Place'+ Blue Island'+ 'IL'+ '12/28/02'+ 'Blue Sunday/White Crow' | ||
| 'Stonecutters ''Seafood'' and Chop House'+ 'Lemont'+ 'IL'+ '12/19/02'+ 'Week Back' | ||
| """ | ||
| sample10 = "Date;Value\r2010-01-01;10\r2010-01-01;20" |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Either move this line into the test function or put the literal into the sniff call. See comment below.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| dialect = sniffer.sniff(self.sample5) | ||
| self.assertEqual(dialect.lineterminator, '\r\n') | ||
| dialect = sniffer.sniff(self.sample8) | ||
| self.assertEqual(dialect.lineterminator, '\n') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This assumes that the line terminator for multiline triple-quoted string literals is '\n'. We require that '\r\n' in code files be converted to '\n' before merging, but the test should not assume '\n' for all developer and user systems where the test might be run. So sample8 should be replaced by a literal.
Since the sample strings need not be long, they can all be literals defined here. Make all 3 the same except for the terminator. This will make the test both crystal clear and independent of system and optional local settings.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| self.assertEqual(dialect.lineterminator, '\n') | ||
| dialect = sniffer.sniff(self.sample10) | ||
| self.assertEqual(dialect.lineterminator, '\r') | ||
|
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Add tests to cover the last line of _guess_lineterminator: return os.linesep. Add a test with the same literal, but with an oddball terminator, such as '\v' (vertical tab), and another with a single line with no control chars.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If you have installed the blurb module (and you should if you think you might submit other PRs), please add a news file with the next revision. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks for making the requested changes! @terryjreedy: please review the changes made to this pull request. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing and reopening to retrigger tests. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Oops, I was not able to reopen after closing as this was on an 'unknown repository'. This pull request will need to be recreated as a new PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.