diff roundup/backends/back_anydbm.py @ 5809:936275dfe1fa

Try to fix: DeprecationWarning: invalid escape sequence \d DeprecationWarning: invalid escape sequence \s DeprecationWarning: invalid escape sequence \) Strings under python 3 are unicode strings rather then "regular" strings as under python 2. So all regexps need to be raw strings. We will see how many I fixed and if I broke any.
author John Rouillard <rouilj@ieee.org>
date Wed, 12 Jun 2019 20:34:47 -0400
parents 6923225fd781
children ee2e8f8d6648
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Wed Jun 12 19:52:29 2019 -0400
+++ b/roundup/backends/back_anydbm.py	Wed Jun 12 20:34:47 2019 -0400
@@ -919,7 +919,7 @@
         newid = self.db.newid(self.classname)
 
         # validate propvalues
-        num_re = re.compile('^\d+$')
+        num_re = re.compile(r'^\d+$')
         for key, value in propvalues.items():
             if key == self.key:
                 try:
@@ -1094,7 +1094,7 @@
                 raise ValueError('Journalling is disabled for this class')
             journal = self.db.getjournal(self.classname, nodeid)
             if journal:
-                num_re = re.compile('^\d+$')
+                num_re = re.compile(r'^\d+$')
                 value = journal[0][2]
                 if num_re.match(value):
                     return value
@@ -1114,7 +1114,7 @@
                 raise ValueError('Journalling is disabled for this class')
             journal = self.db.getjournal(self.classname, nodeid)
             if journal:
-                num_re = re.compile('^\d+$')
+                num_re = re.compile(r'^\d+$')
                 value = journal[-1][2]
                 if num_re.match(value):
                     return value
@@ -1203,7 +1203,7 @@
         node = self.db.getnode(self.classname, nodeid)
         if self.db.RETIRED_FLAG in node:
             raise IndexError
-        num_re = re.compile('^\d+$')
+        num_re = re.compile(r'^\d+$')
 
         # if the journal value is to be different, store it in here
         journalvalues = {}
@@ -1690,7 +1690,7 @@
         return res
 
     def _filter(self, search_matches, filterspec, proptree,
-            num_re = re.compile('^\d+$'), retired=False):
+            num_re = re.compile(r'^\d+$'), retired=False):
         """Return a list of the ids of the nodes in this class that
         match the 'filter' spec, sorted by the group spec and then the
         sort spec.

Roundup Issue Tracker: http://roundup-tracker.org/