diff options
author | Akihiro Motoki <amotoki@gmail.com> | 2019-09-19 17:34:55 +0900 |
---|---|---|
committer | Akihiro Motoki <amotoki@gmail.com> | 2019-09-19 17:34:55 +0900 |
commit | f87c9ee5e951a8a67e35b3bdc4b2591e7338d758 (patch) | |
tree | eec6ab545bee96a170482b84e4c34b22b5a56299 | |
parent | d9546dce754c68084944ec01aaabd33790f8990a (diff) | |
download | glance-f87c9ee5e951a8a67e35b3bdc4b2591e7338d758.tar.gz |
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
-rw-r--r-- | glance/hacking/checks.py | 4 | ||||
-rw-r--r-- | glance/tests/functional/test_reload.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/glance/hacking/checks.py b/glance/hacking/checks.py index 48fe0019c..b1771e008 100644 --- a/glance/hacking/checks.py +++ b/glance/hacking/checks.py @@ -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( diff --git a/glance/tests/functional/test_reload.py b/glance/tests/functional/test_reload.py index 62d51a2df..710b030c3 100644 --- a/glance/tests/functional/test_reload.py +++ b/glance/tests/functional/test_reload.py @@ -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) |