Fix script_utils invalid regex escape warning#577
Open
taivu1998 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #569 by making the
parse_fastaheader-splitting regex inopenfold/utils/script_utils.pya raw string literal.Root Cause
parse_fastaused the normal string literal'\W| \|'. On Python versions that warn about invalid escape sequences more aggressively,\Wis interpreted as an invalid Python string escape before the value reaches the regex engine, producing:The pattern is intended for
re.split, so the regex escapes should be preserved directly.Changes
parse_fastato a raw string literal.script_utils.pythat treatsSyntaxWarningas an error without importing the heavier OpenFold runtime stack.Validation
python3.12 -W error::SyntaxWarning -m py_compile openfold/utils/script_utils.pypython3.12 -m unittest tests.test_script_utilspython3 -m unittest tests.test_script_utilsgit diff --check