Merge "Fix DeprecationWarning: invalid escape sequence"

This commit is contained in:
Zuul 2019-09-25 14:22:29 +00:00 committed by Gerrit Code Review
commit 33eeff6c8d
2 changed files with 3 additions and 3 deletions

View File

@ -32,10 +32,10 @@ Guidelines for writing new hacking checks
asse_trueinst_re = re.compile(
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
"(\w|\.|\'|\"|\[|\])+\)\)")
r"(\w|\.|\'|\"|\[|\])+\)\)")
asse_equal_type_re = re.compile(
r"(.)*assertEqual\(type\((\w|\.|\'|\"|\[|\])+\), "
"(\w|\.|\'|\"|\[|\])+\)")
r"(\w|\.|\'|\"|\[|\])+\)")
asse_equal_end_with_none_re = re.compile(
r"(.)*assertEqual\((\w|\.|\'|\"|\[|\])+, None\)")
asse_equal_start_with_none_re = re.compile(

View File

@ -31,7 +31,7 @@ TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
def set_config_value(filepath, key, value):
"""Set 'key = value' in config file"""
replacement_line = '%s = %s\n' % (key, value)
match = re.compile('^%s\s+=' % key).match
match = re.compile(r'^%s\s+=' % key).match
with open(filepath, 'r+') as f:
lines = f.readlines()
f.seek(0, 0)