Clean up pep8 E711 violations

Fixed E711 errors
All ignores are to be removed in the next sequence of patches

Change-Id: Id9bcdfa276d30639dc6d16b8ce6db19101153fcd
This commit is contained in:
Zhongyue Luo 2012-09-17 17:02:43 +08:00
parent 94012e4832
commit e471d6e5c6
20 changed files with 43 additions and 43 deletions

View File

@ -71,7 +71,7 @@ def _get_compute_nodes(keypath, user, controller):
nova-manage on the controller.
"""
nodes = []
if keypath == None or user == None:
if keypath is None or user is None:
return nodes
lines = utils.util.ssh(keypath, user, controller,
"nova-manage service list | grep ^nova-compute").\
@ -206,7 +206,7 @@ def bash_openstack(manager,
case = random.choice(cases)
logging.debug('Chose %s' % case)
retry = case.invoke(manager, state)
if retry != None:
if retry is not None:
retry_list.append(retry)
else:
logging.info('Cooling down...')

View File

@ -31,7 +31,7 @@ class PendingAction(object):
`nova_manager` : Manager object.
`timeout` : time before we declare a TimeoutException
"""
if timeout == None:
if timeout is None:
timeout = nova_manager.config.compute.build_timeout
self._manager = nova_manager
self._logger = logging.getLogger(self.__class__.__name__)

View File

@ -32,7 +32,7 @@ class TestChangeFloatingIp(test_case.StressTestCase):
self.server_ids = None
def run(self, manager, state, *pargs, **kwargs):
if self.server_ids == None:
if self.server_ids is None:
vms = state.get_instances()
self.server_ids = [k for k, v in vms.iteritems()]
floating_ip = random.choice(state.get_floating_ips())
@ -40,7 +40,7 @@ class TestChangeFloatingIp(test_case.StressTestCase):
return None
floating_ip.change_pending = True
timeout = int(kwargs.get('timeout', 60))
if floating_ip.server_id == None:
if floating_ip.server_id is None:
server = random.choice(self.server_ids)
address = floating_ip.address
self._logger.info('Adding %s to server %s' % (address, server))

View File

@ -143,7 +143,7 @@ class RestClient(object):
tenant_id = auth_data['token']['tenant']['id']
break
if mgmt_url == None:
if mgmt_url is None:
raise exceptions.EndpointNotFound(service)
if service == 'network':
@ -186,7 +186,7 @@ class RestClient(object):
self._set_auth()
self.http_obj = httplib2.Http()
if headers == None:
if headers is None:
headers = {}
headers['X-Auth-Token'] = self.token

View File

@ -226,7 +226,7 @@ class TokenClientJSON(RestClient):
def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
self.http_obj = httplib2.Http()
if headers == None:
if headers is None:
headers = {}
resp, resp_body = self.http_obj.request(url, method,

View File

@ -246,7 +246,7 @@ class TokenClientXML(RestClientXML):
def request(self, method, url, headers=None, body=None):
"""A simple HTTP request interface."""
self.http_obj = httplib2.Http()
if headers == None:
if headers is None:
headers = {}
resp, resp_body = self.http_obj.request(url, method,

View File

@ -11,7 +11,7 @@ class FlavorsClientJSON(RestClient):
def list_flavors(self, params=None):
url = 'flavors'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -24,7 +24,7 @@ class FlavorsClientJSON(RestClient):
def list_flavors_with_detail(self, params=None):
url = 'flavors/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))

View File

@ -12,7 +12,7 @@ class FloatingIPsClientJSON(RestClient):
def list_floating_ips(self, params=None):
"""Returns a list of all floating IPs filtered by any parameters"""
url = 'os-floating-ips'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s" % (param, value))

View File

@ -22,7 +22,7 @@ class ImagesClientJSON(RestClient):
}
}
if meta != None:
if meta is not None:
post_body['createImage']['metadata'] = meta
post_body = json.dumps(post_body)
@ -33,7 +33,7 @@ class ImagesClientJSON(RestClient):
def list_images(self, params=None):
"""Returns a list of all images filtered by any parameters"""
url = 'images'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -47,7 +47,7 @@ class ImagesClientJSON(RestClient):
def list_images_with_detail(self, params=None):
"""Returns a detailed list of images filtered by any parameters"""
url = 'images/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))

View File

@ -13,7 +13,7 @@ class SecurityGroupsClient(RestClient):
"""List all security groups for a user"""
url = 'os-security-groups'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))

View File

@ -51,7 +51,7 @@ class ServersClientJSON(RestClient):
post_param = option
key = option
value = kwargs.get(key)
if value != None:
if value is not None:
post_body[post_param] = value
post_body = json.dumps({'server': post_body})
resp, body = self.post('servers', post_body, self.headers)
@ -72,16 +72,16 @@ class ServersClientJSON(RestClient):
post_body = {}
if meta != None:
if meta is not None:
post_body['metadata'] = meta
if name != None:
if name is not None:
post_body['name'] = name
if accessIPv4 != None:
if accessIPv4 is not None:
post_body['accessIPv4'] = accessIPv4
if accessIPv6 != None:
if accessIPv6 is not None:
post_body['accessIPv6'] = accessIPv6
post_body = json.dumps({'server': post_body})
@ -104,7 +104,7 @@ class ServersClientJSON(RestClient):
"""Lists all servers for a user"""
url = 'servers'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -119,7 +119,7 @@ class ServersClientJSON(RestClient):
"""Lists all servers in detail for a user"""
url = 'servers/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -215,19 +215,19 @@ class ServersClientJSON(RestClient):
'imageRef': image_ref,
}
if name != None:
if name is not None:
post_body['name'] = name
if adminPass != None:
if adminPass is not None:
post_body['adminPass'] = adminPass
if meta != None:
if meta is not None:
post_body['metadata'] = meta
if personality != None:
if personality is not None:
post_body['personality'] = personality
if disk_config != None:
if disk_config is not None:
post_body['OS-DCF:diskConfig'] = disk_config
post_body = json.dumps({'rebuild': post_body})
@ -245,7 +245,7 @@ class ServersClientJSON(RestClient):
}
}
if disk_config != None:
if disk_config is not None:
post_body['resize']['OS-DCF:diskConfig'] = disk_config
post_body = json.dumps(post_body)

View File

@ -17,7 +17,7 @@ class VolumesExtensionsClientJSON(RestClient):
def list_volumes(self, params=None):
"""List all the volumes created"""
url = 'os-volumes'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -31,7 +31,7 @@ class VolumesExtensionsClientJSON(RestClient):
def list_volumes_with_detail(self, params=None):
"""List all the details of volumes"""
url = 'os-volumes/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))

View File

@ -46,7 +46,7 @@ class FlavorsClientXML(RestClientXML):
return [self._format_flavor(xml_to_json(x)) for x in node]
def _list_flavors(self, url, params):
if params != None:
if params is not None:
url += "?%s" % urllib.urlencode(params)
resp, body = self.get(url, self.headers)

View File

@ -43,7 +43,7 @@ class FloatingIPsClientXML(RestClientXML):
def list_floating_ips(self, params=None):
"""Returns a list of all floating IPs filtered by any parameters"""
url = 'os-floating-ips'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s" % (param, value))

View File

@ -82,7 +82,7 @@ class ServersClientXML(RestClientXML):
def list_servers(self, params=None):
url = 'servers/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s" % (param, value))
@ -94,7 +94,7 @@ class ServersClientXML(RestClientXML):
def list_servers_with_detail(self, params=None):
url = 'servers/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s" % (param, value))

View File

@ -38,7 +38,7 @@ class VolumesClientJSON(RestClient):
def list_volumes(self, params=None):
"""List all the volumes created"""
url = 'volumes'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))
@ -51,7 +51,7 @@ class VolumesClientJSON(RestClient):
def list_volumes_with_detail(self, params=None):
"""List the details of all volumes"""
url = 'volumes/detail'
if params != None:
if params is not None:
param_list = []
for param, value in params.iteritems():
param_list.append("%s=%s&" % (param, value))

View File

@ -218,7 +218,7 @@ class AuthorizationTest(BaseComputeTest):
finally:
# Reset the base_url...
self.alt_keypairs_client.base_url = self.saved_base_url
if (resp['status'] != None):
if (resp['status'] is not None):
resp, _ = self.alt_keypairs_client.delete_keypair(k_name)
self.fail("Create keypair request should not happen if the"
" tenant id does not match the current user")
@ -269,7 +269,7 @@ class AuthorizationTest(BaseComputeTest):
finally:
# Reset the base_url...
self.alt_security_client.base_url = self.saved_base_url
if resp['status'] != None:
if resp['status'] is not None:
resp, _ = \
self.alt_security_client.delete_security_group(body['id'])
self.fail("Create Security Group request should not happen if"
@ -314,7 +314,7 @@ class AuthorizationTest(BaseComputeTest):
finally:
# Reset the base_url...
self.alt_security_client.base_url = self.saved_base_url
if resp['status'] != None:
if resp['status'] is not None:
resp, _ = \
self.alt_security_client.delete_security_group_rule(
body['id'])

View File

@ -195,7 +195,7 @@ class FloatingIPsTestBase(object):
else:
self.fail('The floating IP should be associated to the second'
'server')
if (resp['status'] != None):
if (resp['status'] is not None):
#Dissociation of the floating IP associated in this method
resp, _ = \
self.client.disassociate_floating_ip_from_server(

View File

@ -117,7 +117,7 @@ class ImagesTestBase(object):
pass
finally:
if (resp['status'] != None):
if (resp['status'] is not None):
image_id = parse_image_id(resp['location'])
resp, _ = self.client.delete_image(image_id)
self.fail("An image should not be created"

View File

@ -15,4 +15,4 @@ commands = nosetests {posargs}
[testenv:pep8]
deps = pep8==1.3.3
commands = pep8 --ignore=E121,E122,E123,E124,E125,E126,E127,E128,E711 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,kong .
commands = pep8 --ignore=E121,E122,E123,E124,E125,E126,E127,E128 --repeat --show-source --exclude=.venv,.tox,dist,doc,openstack,kong .