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:
parent
3ed97d209f
commit
0bf130077c
|
@ -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
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -733,11 +733,11 @@ def vm_modify(domain, cfgfile, editor, restart):
|
|||
click.echo('')
|
||||
diff = list(difflib.unified_diff(current_vm_cfgfile.split('\n'), new_vm_cfgfile.split('\n'), fromfile='current', tofile='modified', fromfiledate='', tofiledate='', n=3, lineterm=''))
|
||||
for line in diff:
|
||||
if re.match('^\+', line) is not None:
|
||||
if re.match(r'^\+', line) is not None:
|
||||
click.echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
|
||||
elif re.match('^\-', line) is not None:
|
||||
elif re.match(r'^\-', line) is not None:
|
||||
click.echo(colorama.Fore.RED + line + colorama.Fore.RESET)
|
||||
elif re.match('^\^', line) is not None:
|
||||
elif re.match(r'^\^', line) is not None:
|
||||
click.echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
|
||||
else:
|
||||
click.echo(line)
|
||||
|
@ -3039,11 +3039,11 @@ def provisioner_userdata_modify(name, filename, editor):
|
|||
click.echo('')
|
||||
diff = list(difflib.unified_diff(current_userdata.split('\n'), new_userdata.split('\n'), fromfile='current', tofile='modified', fromfiledate='', tofiledate='', n=3, lineterm=''))
|
||||
for line in diff:
|
||||
if re.match('^\+', line) is not None:
|
||||
if re.match(r'^\+', line) is not None:
|
||||
click.echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
|
||||
elif re.match('^\-', line) is not None:
|
||||
elif re.match(r'^\-', line) is not None:
|
||||
click.echo(colorama.Fore.RED + line + colorama.Fore.RESET)
|
||||
elif re.match('^\^', line) is not None:
|
||||
elif re.match(r'^\^', line) is not None:
|
||||
click.echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
|
||||
else:
|
||||
click.echo(line)
|
||||
|
@ -3224,11 +3224,11 @@ def provisioner_script_modify(name, filename, editor):
|
|||
click.echo('')
|
||||
diff = list(difflib.unified_diff(current_script.split('\n'), new_script.split('\n'), fromfile='current', tofile='modified', fromfiledate='', tofiledate='', n=3, lineterm=''))
|
||||
for line in diff:
|
||||
if re.match('^\+', line) is not None:
|
||||
if re.match(r'^\+', line) is not None:
|
||||
click.echo(colorama.Fore.GREEN + line + colorama.Fore.RESET)
|
||||
elif re.match('^\-', line) is not None:
|
||||
elif re.match(r'^\-', line) is not None:
|
||||
click.echo(colorama.Fore.RED + line + colorama.Fore.RESET)
|
||||
elif re.match('^\^', line) is not None:
|
||||
elif re.match(r'^\^', line) is not None:
|
||||
click.echo(colorama.Fore.BLUE + line + colorama.Fore.RESET)
|
||||
else:
|
||||
click.echo(line)
|
||||
|
|
|
@ -118,7 +118,7 @@ def format_bytes_fromhuman(datahuman):
|
|||
# Trim off human-readable character
|
||||
dataunit = str(datahuman)[-1]
|
||||
datasize = int(str(datahuman)[:-1])
|
||||
if not re.match('[A-Z]', dataunit):
|
||||
if not re.match(r'[A-Z]', dataunit):
|
||||
dataunit = 'B'
|
||||
datasize = int(datahuman)
|
||||
databytes = datasize * byte_unit_matrix[dataunit]
|
||||
|
@ -322,9 +322,9 @@ def get_list_osd(zk_conn, limit, is_fuzzy=True):
|
|||
|
||||
if is_fuzzy and limit:
|
||||
# Implicitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
|
||||
for osd in full_osd_list:
|
||||
|
@ -658,9 +658,9 @@ def get_list_volume(zk_conn, pool, limit, is_fuzzy=True):
|
|||
limit = '^' + limit + '$'
|
||||
else:
|
||||
# Implicitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
|
||||
for volume in full_volume_list:
|
||||
|
@ -764,9 +764,9 @@ def get_list_snapshot(zk_conn, pool, volume, limit, is_fuzzy=True):
|
|||
|
||||
if is_fuzzy and limit:
|
||||
# Implicitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
|
||||
for snapshot in full_snapshot_list:
|
||||
|
|
|
@ -574,9 +574,9 @@ def get_list_dhcp(zk_conn, network, limit, only_static=False, is_fuzzy=True):
|
|||
limit = '^' + limit + '$'
|
||||
|
||||
# Implcitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
except Exception as e:
|
||||
return False, 'Regex Error: {}'.format(e)
|
||||
|
@ -620,9 +620,9 @@ def get_list_acl(zk_conn, network, limit, direction, is_fuzzy=True):
|
|||
limit = '^' + limit + '$'
|
||||
|
||||
# Implcitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
except Exception as e:
|
||||
return False, 'Regex Error: {}'.format(e)
|
||||
|
|
|
@ -689,9 +689,9 @@ def get_list(zk_conn, node, state, limit, is_fuzzy=True):
|
|||
if limit and is_fuzzy:
|
||||
try:
|
||||
# Implcitly assume fuzzy limits
|
||||
if not re.match('\^.*', limit):
|
||||
if not re.match(r'\^.*', limit):
|
||||
limit = '.*' + limit
|
||||
if not re.match('.*\$', limit):
|
||||
if not re.match(r'.*\$', limit):
|
||||
limit = limit + '.*'
|
||||
except Exception as e:
|
||||
return False, 'Regex Error: {}'.format(e)
|
||||
|
|
Loading…
Reference in New Issue