-
Notifications
You must be signed in to change notification settings - Fork 56
fix honouring of extract --reverse #201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
dnicolodi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this bug survived so long. Thanks for the fix. Can you please add a test to the beangulp/tests/extract.rst doctest? The other tests there should be guidance enough to add a test for the sorting functionality.
| filename, | ||
| existing_entries, | ||
| reverse=reverse, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think passing reverse as a keyword argument is necessary here. Using a regular argument should make the function call fit on a single line and avoid the ugly black indentation style.
| importer: The importer instance to handle the document. | ||
| filename: Filesystem path to the document. | ||
| existing_entries: Existing entries. | ||
| reverse: Sort extracted entries in descending order. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| reverse: Sort extracted entries in descending order. | |
| reverse: Sort extracted entries in reverse order. |
Whether the order is ascending or descending and which filed is used for sorting depends entirely on the importer implementation.
|
|
||
| # Sort the newly imported entries. | ||
| importer.sort(entries) | ||
| importer.sort(entries, reverse=reverse) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| importer.sort(entries, reverse=reverse) | |
| importer.sort(entries, reverse) |
I was writing my own importer and could not get
extract --reverseto work, until I confirmed I was gettingreverseas False all the time.You can reproduce this with this test: