Fix DeprecationWarning: invalid escape sequence
When running "tox -e pep8", "DeprecationWarning: invalid escape sequence" are shown. This is because a normal string contains escape sequences. Escape sequences need to be placed in raw strings. TrivialFix Change-Id: I34f63d90f53b721e9afdeb99ac53ef0c24857b17
This commit is contained in:
parent
d9546dce75
commit
f87c9ee5e9
@ -32,10 +32,10 @@ Guidelines for writing new hacking checks
|
|||||||
|
|
||||||
asse_trueinst_re = re.compile(
|
asse_trueinst_re = re.compile(
|
||||||
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
r"(.)*assertTrue\(isinstance\((\w|\.|\'|\"|\[|\])+, "
|
||||||
"(\w|\.|\'|\"|\[|\])+\)\)")
|
r"(\w|\.|\'|\"|\[|\])+\)\)")
|
||||||
asse_equal_type_re = re.compile(
|
asse_equal_type_re = re.compile(
|
||||||
r"(.)*assertEqual\(type\((\w|\.|\'|\"|\[|\])+\), "
|
r"(.)*assertEqual\(type\((\w|\.|\'|\"|\[|\])+\), "
|
||||||
"(\w|\.|\'|\"|\[|\])+\)")
|
r"(\w|\.|\'|\"|\[|\])+\)")
|
||||||
asse_equal_end_with_none_re = re.compile(
|
asse_equal_end_with_none_re = re.compile(
|
||||||
r"(.)*assertEqual\((\w|\.|\'|\"|\[|\])+, None\)")
|
r"(.)*assertEqual\((\w|\.|\'|\"|\[|\])+, None\)")
|
||||||
asse_equal_start_with_none_re = re.compile(
|
asse_equal_start_with_none_re = re.compile(
|
||||||
|
@ -31,7 +31,7 @@ TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
|||||||
def set_config_value(filepath, key, value):
|
def set_config_value(filepath, key, value):
|
||||||
"""Set 'key = value' in config file"""
|
"""Set 'key = value' in config file"""
|
||||||
replacement_line = '%s = %s\n' % (key, value)
|
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:
|
with open(filepath, 'r+') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
f.seek(0, 0)
|
f.seek(0, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user