Skip to content
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

Fix sorting of rows with different length using custom itemgetter #601

Conversation

arturponinski
Copy link
Collaborator

@arturponinski arturponinski commented Feb 4, 2022

This PR has the objective of fixing sorting of rows with different length. Closes #385

Changes

  1. Changed comparable_itemgetter to fallback to a custom implementation in case of IndexError and KeyError

Checklist

Use this checklist for assuring the quality of pull requests that include new code and or make changes to existing code.

  • Source Code rules apply:
    • Includes unit tests
    • New functions have docstrings with examples that can be run with doctest
    • New functions are included in API docs
    • Docstrings include notes for any changes to API or behaviour
    • All changes are documented in docs/changes.rst
  • Versioning and history tracking rules apply:
    • Using atomic commits when possible
    • Commits are reversible when possible
    • There is no incomplete changes in the pull request
    • There is no accidental garbage added in source code
  • Testing rules apply:
    • Tested locally using tox / pytest
    • Automated testing passes (see CI)
    • Unit test coverage has not decreased (see Coveralls)
  • State of these changes is:
    • Just a proof of concept
    • Work in progress / Further changes needed
    • Ready to review
    • Ready to merge

@arturponinski arturponinski force-pushed the fix-sorting-tables-with-missing-values-raises-indexerror branch from de5ea1f to bf79ae4 Compare February 4, 2022 19:47
@coveralls
Copy link

coveralls commented Feb 4, 2022

Pull Request Test Coverage Report for Build 1813523682

  • 28 of 28 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 91.871%

Totals Coverage Status
Change from base Build 1813505534: 0.02%
Covered Lines: 12454
Relevant Lines: 13556

💛 - Coveralls

Copy link
Member

@juarezr juarezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Amazing consistency fix
  • Nice work

petl/comparison.py Outdated Show resolved Hide resolved
@juarezr juarezr added Feature A nice to have thing that we don't have yet Usability Improvement that benefit petl usage for end users and removed Feature A nice to have thing that we don't have yet labels Feb 5, 2022
@arturponinski arturponinski force-pushed the fix-sorting-tables-with-missing-values-raises-indexerror branch from 770812f to 14e869f Compare February 8, 2022 16:44
@arturponinski arturponinski merged commit 14e869f into petl-developers:master Feb 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Usability Improvement that benefit petl usage for end users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sorting table with missing values raises IndexError
3 participants