Skip to content

Refactor: Simplify XML replacement logic and remove redundant indentation handling#337

Merged
vicsanity623 merged 8 commits into
mainfrom
pyob-evolution-v1-1781232823
Jun 12, 2026
Merged

Refactor: Simplify XML replacement logic and remove redundant indentation handling#337
vicsanity623 merged 8 commits into
mainfrom
pyob-evolution-v1-1781232823

Conversation

@pyob-bot

Copy link
Copy Markdown
Collaborator

Summary of Changes

  • Refactored the search-and-replace logic in ApplyXMLMixin to use raw search_lines instead of pre-stripped versions, ensuring more accurate matching.
  • Removed the _fix_replace_indentation method call during the replacement process.
  • Simplified the new_code_lines construction by directly injecting replace_lines instead of processing them through an intermediate indentation fix.

Technical Impact

  • Logic Simplification: By removing the automatic indentation fix, the replacement process is now more predictable and relies on the caller to provide correctly formatted replacement lines.
  • Matching Accuracy: The change to sline.strip() not in code_lines[i + j].strip() ensures that the search logic is more robust against whitespace variations while maintaining strict adherence to the provided search patterns.
  • Performance: Reduces overhead by eliminating unnecessary string manipulation and method calls during the replacement loop.

@vicsanity623 vicsanity623 merged commit 95e04b7 into main Jun 12, 2026
1 check passed
@vicsanity623 vicsanity623 deleted the pyob-evolution-v1-1781232823 branch June 12, 2026 03:16
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