MNT: use raw strings for regular expressions #469
Merged
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.
Description of proposed changes
In Python strings '' is the escape to enter some special
characters (ex '\n' for new line and '\t' for tab). Previously
if '' was not followed by a letter that made one of the escape
sequences Python would shrug and assume you really meant just '',
however this leads to lots of silent errors (when you type \m instead
of \n or tau needs to be written \tau) so now Python is warning and
in the future will fail if there is an invalid escape sequence. By
making thees strings 'raw' (the r prefix) it tells Python to never
treat '' in that string as the start of an escape sequence.
What is the goal of this pull request? What does this pull request change?
Testing
This should have no behavior change in released version of Python, will have less warnings in py36+ and is future proofed against (I think) py39 when these will become syntax errors.
It would be best to set your test suite to fail on warnings, but that will require fixing a number of your dependencies (ex neherlab/treetime#108) and finding a way to suppress the warning from
Bio.Alphabet
.Thank you for contributing to Nextstrain!