Skip to content

Respect priority between one- and two-argument callbacks #52

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Carifio24
Copy link
Member

This PR is my proposal to fix #51. I wanted to make sure that:

  • We could sort the one- and two-argument callbacks without having to sort each callback container individually first (since that would be wasteful performance-wise)
  • We don't have to repeat the logic that checks if the instance exists, creates the partial, etc, in multiple places
  • We don't change the current iteration behavior

What I did is to make an iterator method that can take arguments to sort (via priority) or not, and whether to give the priority as part of what's yielded. The default options give the current iteration behavior. Then __iter__ just yields off of iterator. This was the cleanest way I could think to do this without changing too much elsewhere.

If we like this I can add a docstring to iterator and add a test.

@Carifio24 Carifio24 requested a review from astrofrog June 23, 2025 16:18
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.92%. Comparing base (3f04fa7) to head (5de87e6).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   96.90%   96.92%   +0.01%     
==========================================
  Files          19       19              
  Lines        2459     2474      +15     
==========================================
+ Hits         2383     2398      +15     
  Misses         76       76              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Priority is not respected between different callback types
1 participant