Add __reversed__ support to keys, values, and items views#1304
Add __reversed__ support to keys, values, and items views#1304r266-tech wants to merge 1 commit intoaio-libs:masterfrom
Conversation
Implement the method for _KeysView, _ValuesView, and _ItemsView, allowing reversed() iteration over multidict views. Also adds iter_entries_reverse() to _HtKeys for reverse entry traversal. Closes aio-libs#448
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (30.43%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1304 +/- ##
==========================================
- Coverage 99.85% 99.40% -0.46%
==========================================
Files 26 26
Lines 3513 3536 +23
Branches 253 259 +6
==========================================
+ Hits 3508 3515 +7
- Misses 3 19 +16
Partials 2 2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Vizonex
left a comment
There was a problem hiding this comment.
I would recommend you add a C Implementation and not just a Python One. This is because most users will end up with compiled binaries and multidict will default to the C Module if found.
Summary
Implements the
__reversed__method for_KeysView,_ValuesView, and_ItemsView, allowingreversed()iteration over multidict views.Since Python 3.8, built-in
dictviews supportreversed(). This PR brings multidict views to parity.Closes #448.
Changes
iter_entries_reverse()to_HtKeysfor reverse entry traversal__reversed__and_iter_reversedto_KeysView,_ValuesView, and_ItemsViewreversed()Example