Merge "PEP8 cleanup"

This commit is contained in:
Jenkins 2012-01-05 22:58:28 +00:00 committed by Gerrit Code Review
commit d048d47b99
4 changed files with 5 additions and 7 deletions

View File

@ -117,9 +117,7 @@ def swift_copy_object(request, orig_container_name, orig_object_name,
container = swift_api(request).get_container(orig_container_name)
if swift_object_exists(request,
new_container_name,
new_object_name) == True:
if swift_object_exists(request, new_container_name, new_object_name):
raise Exception('Object with name %s already exists in container %s'
% (new_object_name, new_container_name))

View File

@ -344,7 +344,7 @@ class Dashboard(Registry, HorizonComponent):
dashboard in order.
"""
registered = copy.copy(self._registry)
if type(self.panels) is dict:
if isinstance(self.panels, dict):
panels = {}
for heading, items in self.panels.iteritems():
panels.setdefault(heading, [])
@ -412,7 +412,7 @@ class Dashboard(Registry, HorizonComponent):
package = '.'.join(self.__module__.split('.')[:-1])
mod = import_module(package)
panels = []
if type(self.panels) is dict:
if isinstance(self.panels, dict):
[panels.extend(values) for values in self.panels.values()]
else:
panels = self.panels

View File

@ -99,7 +99,7 @@ class GlobalSummary(object):
# usage = usage._info
for k in usage._attrs:
v = usage.__getattr__(k)
if type(v) in [float, int]:
if isinstance(v, (float, int)):
if not k in self.summary:
self.summary[k] = 0
self.summary[k] += v

View File

@ -61,7 +61,7 @@ def horizon_dashboard_nav(context):
if 'request' not in context:
return {}
dashboard = context['request'].horizon['dashboard']
if type(dashboard.panels) is dict:
if isinstance(dashboard.panels, dict):
panels = copy.copy(dashboard.get_panels())
else:
panels = {dashboard.name: dashboard.get_panels()}