Skip to content

Commit

Permalink
Fix syntax warning about an invalid escape sequence
Browse files Browse the repository at this point in the history
With Python 3.12, invalid escape sequences like `\.` in string literals
cause a syntax warning:

```
service/backend/_utils.py:46: SyntaxWarning: invalid escape sequence '\.'
  version = re.sub("\.r[0-9]+$", "", version)
```

Fix this by using the raw string notation instead.
  • Loading branch information
pekkarr committed Aug 7, 2024
1 parent cfc90ef commit 3fd07b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion inst/service/backend/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def ver_strip(version):
version = version.rsplit("-", 1)[0]
version = version.rsplit("+")[0]
# remove things like .r79, see r-cran-rniftilib
version = re.sub("\.r[0-9]+$", "", version)
version = re.sub(r"\.r[0-9]+$", "", version)
return version

def pkg_record(prefixes, name, version, repo):
Expand Down

0 comments on commit 3fd07b1

Please sign in to comment.