Fix some 'DeprecationWarning: invalid escape sequence' warnings and use str.format for string interpolation.

I am seeing a lot of deperecation warnings when I use moto for my tests (running under pytest), so I figured I'll clean up some of them.
This commit is contained in:
Asher Foa 2020-03-12 09:34:25 -07:00
commit 374b623e1d
6 changed files with 20 additions and 18 deletions

View file

@ -95,7 +95,7 @@ def convert_regex_to_flask_path(url_path):
match_name, match_pattern = reg.groups()
return '<regex("{0}"):{1}>'.format(match_pattern, match_name)
url_path = re.sub("\(\?P<(.*?)>(.*?)\)", caller, url_path)
url_path = re.sub(r"\(\?P<(.*?)>(.*?)\)", caller, url_path)
if url_path.endswith("/?"):
# Flask does own handling of trailing slashes