Skip to content

Comments

Optimize parse parts#104

Merged
p1c2u merged 1 commit intomasterfrom
feature/optimize-parse-parts-2
Feb 18, 2026
Merged

Optimize parse parts#104
p1c2u merged 1 commit intomasterfrom
feature/optimize-parse-parts-2

Conversation

@p1c2u
Copy link
Owner

@p1c2u p1c2u commented Feb 18, 2026

This pull request refactors the parse_parts function in pathable/parsers.py to simplify its logic and improve readability. The main change is the removal of the nested append_split helper function, with its logic now inlined directly into the main loop. This results in a more straightforward and easier-to-follow function.

Refactoring and code simplification:

  • Inlined the logic of the append_split helper function directly into the main loop, removing unnecessary function indirection and making the handling of str and bytes parts more explicit and readable.
  • Removed the reversal of parts processing order and now processes parts in their original order, which may affect the output order if the function is used elsewhere.
  • Improved handling of str and bytes types by directly checking for empty strings and separator presence, reducing code complexity.

@p1c2u p1c2u merged commit 7638b24 into master Feb 18, 2026
10 checks passed
@p1c2u p1c2u deleted the feature/optimize-parse-parts-2 branch February 18, 2026 18:19
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.

1 participant