Lint: E202 whitespace before ']'

This commit is contained in:
Joshua Boniface 2020-11-07 13:02:54 -05:00
parent d2e5ede399
commit d2490419c5
9 changed files with 25 additions and 27 deletions

View File

@ -117,7 +117,7 @@ def list_template(limit, table, is_fuzzy=True):
data = cur.fetchall()
if not isinstance(data, list):
data = [data ]
data = [data]
if table == 'network_template':
for template_id, template_data in enumerate(data):

View File

@ -282,7 +282,7 @@ def format_list_osd(osd_list):
osd_list = list()
# Handle single-item list
if not isinstance(osd_list, list):
osd_list = [osd_list ]
osd_list = [osd_list]
osd_list_output = []
@ -608,7 +608,7 @@ def format_list_pool(pool_list):
pool_list = list()
# Handle single-entry list
if not isinstance(pool_list, list):
pool_list = [pool_list ]
pool_list = [pool_list]
pool_list_output = []
@ -964,7 +964,7 @@ def format_list_volume(volume_list):
volume_list = list()
# Handle single-entry list
if not isinstance(volume_list, list):
volume_list = [volume_list ]
volume_list = [volume_list]
volume_list_output = []
@ -1181,7 +1181,7 @@ def format_list_snapshot(snapshot_list):
snapshot_list = list()
# Handle single-entry list
if not isinstance(snapshot_list, list):
snapshot_list = [snapshot_list ]
snapshot_list = [snapshot_list]
snapshot_list_output = []
@ -1307,7 +1307,7 @@ def format_list_benchmark(config, benchmark_information):
benchmark_iops_length = dict()
# For this output, we're only showing the Sequential (seq_read and seq_write) and 4k Random (rand_read_4K and rand_write_4K) results since we're showing them for each test result.
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K" ]:
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K"]:
benchmark_bandwidth_length[test] = 7
benchmark_iops_length[test] = 6
@ -1323,7 +1323,7 @@ def format_list_benchmark(config, benchmark_information):
benchmark_bandwidth = dict()
benchmark_iops = dict()
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K" ]:
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K"]:
benchmark_bandwidth[test] = format_bytes_tohuman(int(benchmark_data[test]['overall']['bandwidth']) * 1024)
benchmark_iops[test] = format_ops_tohuman(int(benchmark_data[test]['overall']['iops']))
@ -1385,7 +1385,7 @@ def format_list_benchmark(config, benchmark_information):
else:
benchmark_bandwidth = dict()
benchmark_iops = dict()
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K" ]:
for test in ["seq_read", "seq_write", "rand_read_4K", "rand_write_4K"]:
benchmark_data = json.loads(benchmark['benchmark_result'])
benchmark_bandwidth[test] = format_bytes_tohuman(int(benchmark_data[test]['overall']['bandwidth']) * 1024)
benchmark_iops[test] = format_ops_tohuman(int(benchmark_data[test]['overall']['iops']))

View File

@ -423,7 +423,7 @@ def format_list(config, network_list):
# Handle single-element lists
if not isinstance(network_list, list):
network_list = [network_list ]
network_list = [network_list]
network_list_output = []
@ -603,7 +603,7 @@ def format_list_acl(acl_list):
acl_list = list()
# Handle when we get a single entry
if isinstance(acl_list, dict):
acl_list = [acl_list ]
acl_list = [acl_list]
acl_list_output = []

View File

@ -181,7 +181,7 @@ def format_info(node_information, long_output):
def format_list(node_list, raw):
# Handle single-element lists
if not isinstance(node_list, list):
node_list = [node_list ]
node_list = [node_list]
if raw:
ainformation = list()

View File

@ -668,12 +668,12 @@ def format_list_template(template_data, template_type=None):
template_type can be used to only display part of the full list, allowing function
reuse with more limited output options.
"""
template_types = ['system', 'network', 'storage' ]
template_types = ['system', 'network', 'storage']
normalized_template_data = dict()
ainformation = list()
if template_type in template_types:
template_types = [template_type ]
template_types = [template_type]
template_data_type = '{}_templates'.format(template_type)
normalized_template_data[template_data_type] = template_data
else:
@ -702,7 +702,7 @@ def format_list_template(template_data, template_type=None):
def format_list_template_system(template_data):
if isinstance(template_data, dict):
template_data = [template_data ]
template_data = [template_data]
template_list_output = []
@ -850,7 +850,7 @@ Meta: {template_node_limit: <{template_node_limit_length}} \
def format_list_template_network(template_template):
if isinstance(template_template, dict):
template_template = [template_template ]
template_template = [template_template]
template_list_output = []
@ -924,7 +924,7 @@ def format_list_template_network(template_template):
def format_list_template_storage(template_template):
if isinstance(template_template, dict):
template_template = [template_template ]
template_template = [template_template]
template_list_output = []
@ -1059,7 +1059,7 @@ def format_list_template_storage(template_template):
def format_list_userdata(userdata_data, lines=None):
if isinstance(userdata_data, dict):
userdata_data = [userdata_data ]
userdata_data = [userdata_data]
userdata_list_output = []
@ -1133,7 +1133,7 @@ def format_list_userdata(userdata_data, lines=None):
def format_list_script(script_data, lines=None):
if isinstance(script_data, dict):
script_data = [script_data ]
script_data = [script_data]
script_list_output = []
@ -1207,7 +1207,7 @@ def format_list_script(script_data, lines=None):
def format_list_ova(ova_data):
if isinstance(ova_data, dict):
ova_data = [ova_data ]
ova_data = [ova_data]
ova_list_output = []
@ -1320,7 +1320,7 @@ def format_list_ova(ova_data):
def format_list_profile(profile_data):
if isinstance(profile_data, dict):
profile_data = [profile_data ]
profile_data = [profile_data]
# Format the profile "source" from the type and, if applicable, OVA profile name
for profile in profile_data:

View File

@ -481,7 +481,7 @@ def format_info(config, domain_information, long_output):
def format_list(config, vm_list, raw):
# Handle single-element lists
if not isinstance(vm_list, list):
vm_list = [vm_list ]
vm_list = [vm_list]
# Function to strip the "br" off of nets and return a nicer list
def getNiceNetID(domain_information):

View File

@ -869,7 +869,7 @@ def getCephVolumes(zk_conn, pool):
if not pool:
pool_list = zkhandler.listchildren(zk_conn, '/ceph/pools')
else:
pool_list = [pool ]
pool_list = [pool]
for pool_name in pool_list:
for volume_name in zkhandler.listchildren(zk_conn, '/ceph/volumes/{}'.format(pool_name)):
@ -1209,7 +1209,7 @@ def getCephSnapshots(zk_conn, pool, volume):
for volume_entry in volume_list:
volume_pool, volume_name = volume_entry.split('/')
if volume_name == volume:
volume_list = ['{}/{}'.format(volume_pool, volume_name) ]
volume_list = ['{}/{}'.format(volume_pool, volume_name)]
for volume_entry in volume_list:
for snapshot_name in zkhandler.listchildren(zk_conn, '/ceph/snapshots/{}'.format(volume_entry)):

View File

@ -656,7 +656,7 @@ def get_list(zk_conn, node, state, limit, is_fuzzy=True):
return False, 'Specified node "{}" is invalid.'.format(node)
if state:
valid_states = ['start', 'restart', 'shutdown', 'stop', 'disable', 'fail', 'migrate', 'unmigrate', 'provision' ]
valid_states = ['start', 'restart', 'shutdown', 'stop', 'disable', 'fail', 'migrate', 'unmigrate', 'provision']
if state not in valid_states:
return False, 'VM state "{}" is not valid.'.format(state)

View File

@ -222,9 +222,7 @@ def readConfig(pvcnoded_config_file, myhostname):
config = {**config, **config_networking}
# Create the by-id address entries
for net in ['vni',
'storage',
'upstream' ]:
for net in ['vni', 'storage', 'upstream']:
address_key = '{}_dev_ip'.format(net)
floating_key = '{}_floating_ip'.format(net)
network_key = '{}_network'.format(net)