Lint: W605 invalid escape sequence '<char>'

The previous attempt to correct these with character classes failed.
Instead, use the proper `r'blah'` regex formatting.
This commit is contained in:
2020-11-07 17:41:09 -05:00
parent 3ed97d209f
commit 0bf130077c
6 changed files with 33 additions and 33 deletions

View File

@ -70,11 +70,11 @@ def list_ova(limit, is_fuzzy=True):
if limit:
if is_fuzzy:
# Handle fuzzy vs. non-fuzzy limits
if not re.match('\^.*', limit):
if not re.match(r'\^.*', limit):
limit = '%' + limit
else:
limit = limit[1:]
if not re.match('.*\$', limit):
if not re.match(r'.*\$', limit):
limit = limit + '%'
else:
limit = limit[:-1]
@ -252,7 +252,7 @@ def upload_ova(pool, name, ova_size):
return output, retcode
# Parse through the members list and extract the OVF file
for element in set(x for x in members if re.match('.*\.ovf$', x.name)):
for element in set(x for x in members if re.match(r'.*\.ovf$', x.name)):
ovf_file = ova_archive.extractfile(element)
# Parse the OVF file to get our VM details

View File

@ -106,11 +106,11 @@ def list_template(limit, table, is_fuzzy=True):
if limit:
if is_fuzzy:
# Handle fuzzy vs. non-fuzzy limits
if not re.match('\^.*', limit):
if not re.match(r'\^.*', limit):
limit = '%' + limit
else:
limit = limit[1:]
if not re.match('.*\$', limit):
if not re.match(r'.*\$', limit):
limit = limit + '%'
else:
limit = limit[:-1]
@ -606,11 +606,11 @@ def list_userdata(limit, is_fuzzy=True):
if limit:
if is_fuzzy:
# Handle fuzzy vs. non-fuzzy limits
if not re.match('\^.*', limit):
if not re.match(r'\^.*', limit):
limit = '%' + limit
else:
limit = limit[1:]
if not re.match('.*\$', limit):
if not re.match(r'.*\$', limit):
limit = limit + '%'
else:
limit = limit[:-1]
@ -701,11 +701,11 @@ def list_script(limit, is_fuzzy=True):
if limit:
if is_fuzzy:
# Handle fuzzy vs. non-fuzzy limits
if not re.match('\^.*', limit):
if not re.match(r'\^.*', limit):
limit = '%' + limit
else:
limit = limit[1:]
if not re.match('.*\$', limit):
if not re.match(r'.*\$', limit):
limit = limit + '%'
else:
limit = limit[:-1]
@ -796,11 +796,11 @@ def list_profile(limit, is_fuzzy=True):
if limit:
if is_fuzzy:
# Handle fuzzy vs. non-fuzzy limits
if not re.match('\^.*', limit):
if not re.match(r'\^.*', limit):
limit = '%' + limit
else:
limit = limit[1:]
if not re.match('.*\$', limit):
if not re.match(r'.*\$', limit):
limit = limit + '%'
else:
limit = limit[:-1]