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
This commit is contained in:
Kaifeng Wang 2019-06-06 14:42:58 +08:00
parent 91e5a145f2
commit 9ffb6054df

View File

@ -23,7 +23,7 @@ UNDERSCORE_IMPORT_FILES = []
string_translation = re.compile(r"[^_]*_\(\s*('|\")") string_translation = re.compile(r"[^_]*_\(\s*('|\")")
translated_log = re.compile( translated_log = re.compile(
r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)" r"(.)*LOG\.(audit|error|info|warn|warning|critical|exception)"
"\(\s*_\(\s*('|\")") r"\(\s*_\(\s*('|\")")
underscore_import_check = re.compile(r"(.)*import _(.)*") underscore_import_check = re.compile(r"(.)*import _(.)*")
# We need this for cases where they have created their own _ function. # We need this for cases where they have created their own _ function.
custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*") custom_underscore_check = re.compile(r"(.)*_\s*=\s*(.)*")