From b882c312465c311dfde059d6266efca2a43ec8e0 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 9 Apr 2019 15:53:49 -0500 Subject: Use raw string for regex Special characters in regular strings now cause DeprecationWarnings starting with Python 3.6. This frequently happens with regex strings. Oslo.log had one instance of a regex string containing '\' that would cause deprecation warnings in logs. This switches that instance over to be a raw string to avoid these warnings. Change-Id: Ia5637f35315127c5cc46e01f5e38eccb094e772d Signed-off-by: Sean McGinnis --- oslo_log/formatters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslo_log/formatters.py b/oslo_log/formatters.py index 8386ccc..bc0a6e1 100644 --- a/oslo_log/formatters.py +++ b/oslo_log/formatters.py @@ -181,7 +181,7 @@ class _ReplaceFalseValue(dict): return dict.get(self, key, None) or '-' -_MSG_KEY_REGEX = re.compile('(%+)\((\w+)\)') +_MSG_KEY_REGEX = re.compile(r'(%+)\((\w+)\)') class JSONFormatter(logging.Formatter): -- cgit v1.2.1