fix: more list comprehension and correct pipeline initialisation #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the
Pipelineclass inefemel/pipeline.pyto simplify its implementation and improve readability while maintaining functionality. Key changes include replacing nested loops with generator expressions, updating type hints for better clarity, and streamlining methods for single-function application. Corresponding test cases intests/test_pipeline.pyhave been updated to reflect these changes.Pipeline Refactoring:
Simplified Method Implementations:
__iter__,to_list, andflattenfor improved readability and efficiency. (Faea2baaL99R99, Faea2baaL192R192)filterandmapmethods by directly using generator expressions for chunk processing. (Faea2baaL141R141)tapandeachmethods to usedequefor efficient consumption of elements. (Faea2baaL172R172)Improved Type Hints:
Uniontype hints to support multiple types forsourcein the constructor andflattenmethod. (efemel/pipeline.pyL16-R19, Faea2baaL172R172)Refactored
applyMethod:applyto handle only a single transformation function, removing support for multiple functions. (Faea2baaL301R301)Test Updates:
apply, reflecting the refactored method's new behavior.test_apply_functionfor clarity.