Skip to content

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
@codecov
Copy link

codecov bot commented Jun 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.95%. Comparing base (3f04fa7) to head (583efc6).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
+ Coverage   96.90%   96.95%   +0.04%     
==========================================
  Files          19       19              
  Lines        2459     2493      +34     
==========================================
+ Hits         2383     2417      +34     
  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.

Copy link
Member

@astrofrog astrofrog left a comment

Choose a reason for hiding this comment

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

Sorry for the delay - this looks good, but could you add a regression test for this?

@Carifio24
Copy link
Member Author

@astrofrog I've added a test that checks that we have the correct order in both directions (i.e. whether it's the one- or two-argument callback that has a higher priority). I also added a docstring for the new iterator method on the callback container.

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

2 participants