Fix SyntaxWarning invalid escape sequence in Python code (#3433)

This commit is contained in:
Christian Clauss
2024-05-03 02:22:33 +02:00
committed by GitHub
parent 380c740ff0
commit b7551cbba6
37 changed files with 156 additions and 156 deletions

View File

@@ -54,12 +54,12 @@ class TestVersion(TestCase):
"""Copyright is current"""
code, out, err = self.t("version")
expected = "Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
expected = r"Copyright \(C\) \d{4} - %d" % (datetime.now().year,)
self.assertRegex(out, expected)
def slurp(self, file="../CMakeLists.txt"):
number = "\.".join(["[0-9]+"] * 3)
ver = re.compile("^set \(PROJECT_VERSION \"({0}[^\"]*)\"\)$".format(number))
number = r"\.".join(["[0-9]+"] * 3)
ver = re.compile("^set \\(PROJECT_VERSION \"({0}[^\"]*)\"\\)$".format(number))
with open(file) as fh:
for line in fh:
if "PROJECT_VERSION" in line: