-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ut.update_template_file()
: fix IndexError due to special character +
#1326
ut.update_template_file()
: fix IndexError due to special character +
#1326
Conversation
💖 Thanks for opening this pull request! Please check out our contributing guidelines. 💖 |
Reviewer's Guide by SourceryThis pull request fixes an Sequence diagram for update_template_file functionsequenceDiagram
participant UT as utils1.py
participant RE as re module
UT->>UT: update_template_file(template_file, extra_dict)
loop For each key-value pair in extra_dict
UT->>UT: value2search = value
UT->>UT: Escape special characters in value2search
UT->>RE: re.findall(value2search, line)
RE-->>UT: Returns a list of matches
alt Match found
UT->>UT: Replace old value with new value in line
else Match not found
UT->>UT: Log warning
end
end
UT-->>UT: Return updated template content
Updated class diagram for utils1.pyclassDiagram
class utils1 {
+update_template_file(template_file, extra_dict, delimiter='=')
}
note for utils1 "Fixes an IndexError in update_template_file when trying to set a value containing the '+' character."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR SummaryThis Pull Request addresses a bug in the Review Checklist
SuggestionTo further enhance the robustness of the This comment was generated by AI. Information provided may be incorrect. Current plan usage: 0% Have feedback or need help? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @MarritL - I've reviewed your changes - here's some feedback:
Overall Comments:
- It's good you're escaping special characters, but consider doing it with a single call to
re.escape
.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
ut.update_template_file()
: fix IndexError due to special character +
smallbaselineApp.TimeSeriesAnalysis.run_unwrap_error_correction(): ignore whitespace to support input method value of `bridging + phase_closure`
LGTM. Thank you @MarritL. I was able to reproduce the error while switching between UPDATE: My commit above failed the test, I will revert this and merge your changes only for now, will try this later. |
This reverts commit d3bc690.
🎉 🎉 🎉 Congrats on merging your first pull request! We here at behaviorbot are proud of you! 🎉 🎉 🎉 |
Description of proposed changes
Fix IndexError in update_template_file when trying to set the value 'briging+phase_closure' on 'mintpy.unwrapError.method'.
With my debug messages:
DEBUG value2search: [\s]*bridging+phase_closure
DEBUG line: mintpy.unwrapError.method = bridging+phase_closure \n'
Reminders
Summary by Sourcery
Bug Fixes:
IndexError
in theupdate_template_file
function that occurred when processing special characters like '+' in template values. The fix ensures that these characters are properly escaped when constructing regular expressions for searching and replacing values in template files.