From 9ffb6054dfb0eb51845cfdcd80a784dd6728a15b Mon Sep 17 00:00:00 2001 From: Kaifeng Wang Date: Thu, 6 Jun 2019 14:42:58 +0800 Subject: [PATCH] Fix regex string in the hacking check I am seeing this warning recently: ironic/hacking/checks.py:26: DeprecationWarning: invalid escape sequence \( "\(\s*_\(\s*('|\")") It appears that the second line is not a raw string at all. Change-Id: I39da54d50f069d6bec6c2575b448d7a1e9feea03 --- ironic/hacking/checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ironic/hacking/checks.py b/ironic/hacking/checks.py index b502af02b1..6c2ac23fd0 100644 --- a/ironic/hacking/checks.py +++ b/ironic/hacking/checks.py @@ -23,7 +23,7 @@ UNDERSCORE_IMPORT_FILES = [] string_translation = re.compile(r"[^_]*_\(\s*('|\")") translated_log = re.compile( r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)" - "\(\s*_\(\s*('|\")") + r"\(\s*_\(\s*('|\")") underscore_import_check = re.compile(r"(.)*import _(.)*") # We need this for cases where they have created their own _ function. custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*")