Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add chunked_filter for batch predicates - #491

Open
vzer200 wants to merge 1 commit into
mahmoud:masterfrom
vzer200:add-chunked-filter
Open

Add chunked_filter for batch predicates#491
vzer200 wants to merge 1 commit into
mahmoud:masterfrom
vzer200:add-chunked-filter

Conversation

@vzer200

@vzer200 vzer200 commented Sep 8, 2026

Copy link
Copy Markdown

Add chunked_filter(src, size, key=None) to filter an iterable using a predicate that handles batches, such as a database or API lookup. The helper preserves item order and identity, reads input one chunk at a time, and checks that the predicate returns one truth value per item.

This follows the feature discussion in #344 and the naming, error-message, and documentation feedback on the closed #346. It includes a batch-lookup doctest, an API documentation entry, and tests for lazy consumption, partial final chunks, generator predicates, invalid inputs, and predicate errors.

Fixes #344.

Validation: 103 iterutils tests/doctests passed; the complete suite passed with 689 tests/doctests on Windows with Python 3.12.14. git diff --check passed.

AI-assisted implementation, independently reviewed by a second coding agent.

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.

chunked filter

1 participant