Remove redundant parentheses

This commit is contained in:
rallytime 2015-09-04 15:58:16 -06:00
parent 5045989be7
commit bf33c99b08
6 changed files with 12 additions and 13 deletions

View file

@ -2275,7 +2275,7 @@ def run_parallel_map_providers_query(data, queue=None):
exc_info_on_loglevel=logging.DEBUG
)
# Failed to communicate with the provider, don't list any nodes
return (data['alias'], data['driver'], ())
return data['alias'], data['driver'], ()
# for pickle and multiprocessing, we can't use directly decorators

View file

@ -716,7 +716,7 @@ def _compute_signature(parameters, access_key_secret):
sortedParameters = sorted(list(parameters.items()), key=lambda items: items[0])
canonicalizedQueryString = ''
for (k, v) in sortedParameters:
for k, v in sortedParameters:
canonicalizedQueryString += '&' + percent_encode(k) \
+ '=' + percent_encode(v)

View file

@ -1193,12 +1193,11 @@ def _create_eni_if_necessary(interface):
params = {'SubnetId': interface['SubnetId']}
for k in ('Description', 'PrivateIpAddress',
'SecondaryPrivateIpAddressCount'):
for k in 'Description', 'PrivateIpAddress', 'SecondaryPrivateIpAddressCount':
if k in interface:
params[k] = interface[k]
for k in ('PrivateIpAddresses', 'SecurityGroupId'):
for k in 'PrivateIpAddresses', 'SecurityGroupId':
if k in interface:
params.update(_param_from_config(k, interface[k]))
@ -1605,7 +1604,7 @@ def request_instance(vm_=None, call=None):
if not isinstance(ex_securitygroupid, list):
params[spot_prefix + 'SecurityGroupId.1'] = ex_securitygroupid
else:
for (counter, sg_) in enumerate(ex_securitygroupid):
for counter, sg_ in enumerate(ex_securitygroupid):
params[
spot_prefix + 'SecurityGroupId.{0}'.format(counter)
] = sg_

View file

@ -258,7 +258,7 @@ def ssh_username(vm_):
initial = usernames[:]
# Add common usernames to the list to be tested
for name in ('ec2-user', 'ubuntu', 'admin', 'bitnami', 'root'):
for name in 'ec2-user', 'ubuntu', 'admin', 'bitnami', 'root':
if name not in usernames:
usernames.append(name)
# Add the user provided usernames to the end of the list since enough time

View file

@ -641,7 +641,7 @@ def create_node(vm_):
vmhost = vm_['host']
newnode['vmid'] = _get_next_vmid()
for prop in ('cpuunits', 'description', 'memory', 'onboot'):
for prop in 'cpuunits', 'description', 'memory', 'onboot':
if prop in vm_: # if the property is set, use it for the VM request
newnode[prop] = vm_[prop]
@ -651,12 +651,12 @@ def create_node(vm_):
newnode['ostemplate'] = vm_['image']
# optional VZ settings
for prop in ('cpus', 'disk', 'ip_address', 'nameserver', 'password', 'swap', 'poolid'):
for prop in 'cpus', 'disk', 'ip_address', 'nameserver', 'password', 'swap', 'poolid':
if prop in vm_: # if the property is set, use it for the VM request
newnode[prop] = vm_[prop]
elif vm_['technology'] == 'qemu':
# optional Qemu settings
for prop in ('acpi', 'cores', 'cpu', 'pool'):
for prop in 'acpi', 'cores', 'cpu', 'pool':
if prop in vm_: # if the property is set, use it for the VM request
newnode[prop] = vm_[prop]

View file

@ -173,7 +173,7 @@ def accept_key(pki_dir, pub, id_):
the opts directory, this method places the pub key in the accepted
keys dir and removes it from the unaccepted keys dir if that is the case.
'''
for key_dir in ('minions', 'minions_pre', 'minions_rejected'):
for key_dir in 'minions', 'minions_pre', 'minions_rejected':
key_path = os.path.join(pki_dir, key_dir)
if not os.path.exists(key_path):
os.makedirs(key_path)
@ -2455,7 +2455,7 @@ def delete_minion_cachedir(minion_id, provider, opts, base=None):
driver = next(six.iterkeys(opts['providers'][provider]))
fname = '{0}.p'.format(minion_id)
for cachedir in ('requested', 'active'):
for cachedir in 'requested', 'active':
path = os.path.join(base, cachedir, driver, provider, fname)
log.debug('path: {0}'.format(path))
if os.path.exists(path):
@ -2525,7 +2525,7 @@ def update_bootstrap(config, url=None):
url = default_url
if not url:
raise ValueError('Cant get any source to update')
if (url.startswith('http')) or ('://' in url):
if url.startswith('http') or '://' in url:
log.debug('Updating the bootstrap-salt.sh script to latest stable')
try:
import requests