[d-feet/enable-gitlab-ci: 2/4] settings: use r'' strings for regexps



commit 5532bf699a4a190b72e36ea44bf984a9d1bf1cd6
Author: Will Thompson <will willthompson co uk>
Date:   Wed Sep 19 11:15:02 2018 +0100

    settings: use r'' strings for regexps
    
    ../../src/dfeet/settings.py:22:17: W605 invalid escape sequence '\.'
    ../../src/dfeet/settings.py:23:6: W605 invalid escape sequence '\s'
    ../../src/dfeet/settings.py:28:10: W605 invalid escape sequence '\s'
    ../../src/dfeet/settings.py:29:12: W605 invalid escape sequence '\('

 src/dfeet/settings.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/dfeet/settings.py b/src/dfeet/settings.py
index ffd5f29..681797a 100644
--- a/src/dfeet/settings.py
+++ b/src/dfeet/settings.py
@@ -18,15 +18,15 @@ class ConfigTokenizer():
     COMMA = re.compile(",")
     FALLTHROUGH = re.compile('(?:[^,.])+')
     # FIXME: String re does not ignore escaped quotes (e.g. \") correctly
-    STRING = re.compile('"((?:[^\\"]|\\.)*)"' + "|'((?:[^\\']|\\.)*)'")
-    NUMBER = re.compile('[+-]?[0-9]*\.?[0-9]+')
-    WHITESPACE = re.compile('\s')
+    STRING = re.compile(r'"((?:[^\"]|\.)*)"' + "|'((?:[^\']|\.)*)'")
+    NUMBER = re.compile(r'[+-]?[0-9]*\.?[0-9]+')
+    WHITESPACE = re.compile(r'\s')
 
     _parse_order = [STRING, NUMBER, WHITESPACE, COMMA, FALLTHROUGH]
 
     class Match():
-        ENDWHITESPACE = re.compile('\s$')
-        UNESCAPE = re.compile('\\\(.)')
+        ENDWHITESPACE = re.compile(r'\s$')
+        UNESCAPE = re.compile(r'\\\(.)')
 
         def __init__(self, match, regex):
             self.match = match


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]