use raw strings with re.compile
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 25 Nov 2024 08:01:41 +0000 (09:01 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 25 Nov 2024 08:01:41 +0000 (09:01 +0100)
PLC/Persons.py
migrations/extract-views.py

index bc4b4c1..6e1b240 100644 (file)
@@ -78,7 +78,7 @@ class Person(Row):
         if not email:
             raise invalid_email
 
-        email_re = re.compile('\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z')
+        email_re = re.compile(r'\A[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9._\-]+\.[a-zA-Z]+\Z')
         if not email_re.match(email):
             raise invalid_email
 
index 4a20465..59089e1 100755 (executable)
@@ -10,9 +10,9 @@ class Schema:
         self.output=output
 
     # left part is non-greedy
-    comment = re.compile("(.*?)--.*")
-    spaces = re.compile("^\s+(\S.*)")
-    view = re.compile("(?i)\s*create\s+(or\s+replace)?\s+view.*")
+    comment = re.compile(r"(.*?)--.*")
+    spaces = re.compile(r"^\s+(\S.*)")
+    view = re.compile(r"(?i)\s*create\s+(or\s+replace)?\s+view.*")
 
     def parse (self):
         if self.output: