summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGinnis <sean.mcginnis@gmail.com>2019-04-09 16:55:18 -0500
committerSean McGinnis <sean.mcginnis@gmail.com>2019-04-11 06:10:18 -0500
commitcaaac6c438fd75453d3d117fc379cdc6046f47b5 (patch)
tree32059cb4ede72a24b5051c89a28ed156e54da1a9
parentc14cef7a3fcbc6add4afea16efe4e05f65867794 (diff)
downloadoslo-middleware-caaac6c438fd75453d3d117fc379cdc6046f47b5.tar.gz
Fix invalid escape sequence warnings
Py36 is more strict about escape sequences in strings. Regex patterns often cause warnings due to not being normal escape sequences. This gets rid of a few warnings by switching these regex strings to use raw strings. Change-Id: Ied16e55780f2bf73fac54e0afc8394af468a67b8 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
-rw-r--r--.gitignore1
-rw-r--r--oslo_middleware/catch_errors.py2
-rw-r--r--oslo_middleware/stats.py6
3 files changed, 5 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index adf36be..ef39dd9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,6 +17,7 @@
# Packages
*.egg
+*.eggs
*.egg-info
dist
build
diff --git a/oslo_middleware/catch_errors.py b/oslo_middleware/catch_errors.py
index 220d704..eab36df 100644
--- a/oslo_middleware/catch_errors.py
+++ b/oslo_middleware/catch_errors.py
@@ -24,7 +24,7 @@ from oslo_middleware import base
LOG = logging.getLogger(__name__)
-_TOKEN_RE = re.compile('^(X-\w+-Token):.*$', flags=re.MULTILINE)
+_TOKEN_RE = re.compile(r'^(X-\w+-Token):.*$', flags=re.MULTILINE)
class CatchErrors(base.ConfigurableMiddleware):
diff --git a/oslo_middleware/stats.py b/oslo_middleware/stats.py
index 9839fd5..11c4789 100644
--- a/oslo_middleware/stats.py
+++ b/oslo_middleware/stats.py
@@ -21,12 +21,12 @@ import webob.dec
from oslo_middleware import base
LOG = logging.getLogger(__name__)
-VERSION_REGEX = re.compile("/(v[0-9]{1}\.[0-9]{1})")
+VERSION_REGEX = re.compile(r"/(v[0-9]{1}\.[0-9]{1})")
UUID_REGEX = re.compile(
- '.*(\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}).*a',
+ r'.*(\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}).*a',
re.IGNORECASE)
# UUIDs without the - char, used in some places in Nova URLs.
-SHORT_UUID_REGEX = re.compile('.*(\.[0-9a-fA-F]{32}).*')
+SHORT_UUID_REGEX = re.compile(r'.*(\.[0-9a-fA-F]{32}).*')
class StatsMiddleware(base.ConfigurableMiddleware):