Skip to content

Conversation

@ringoldsdev
Copy link
Owner

This pull request refactors the Pipeline class in efemel/pipeline.py to 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 in tests/test_pipeline.py have been updated to reflect these changes.

Pipeline Refactoring:

  • Simplified Method Implementations:

    • Replaced nested loops with generator expressions in methods like __iter__, to_list, and flatten for improved readability and efficiency. (Faea2baaL99R99, Faea2baaL192R192)
    • Streamlined filter and map methods by directly using generator expressions for chunk processing. (Faea2baaL141R141)
    • Updated tap and each methods to use deque for efficient consumption of elements. (Faea2baaL172R172)
  • Improved Type Hints:

    • Added Union type hints to support multiple types for source in the constructor and flatten method. (efemel/pipeline.pyL16-R19, Faea2baaL172R172)
  • Refactored apply Method:

    • Simplified apply to handle only a single transformation function, removing support for multiple functions. (Faea2baaL301R301)

Test Updates:

  • Updated Test Cases:
    • Removed tests for multi-function application and no-function application in apply, reflecting the refactored method's new behavior.
    • Renamed test for single-function application to test_apply_function for clarity.

@ringoldsdev ringoldsdev merged commit 0354f3e into main Jul 11, 2025
1 check passed
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.

2 participants