Merge "Tech Debt: Fixed code alignment issues"

This commit is contained in:
Jenkins 2015-02-07 22:25:45 +00:00 committed by Gerrit Code Review
commit 2300776161
8 changed files with 24 additions and 24 deletions

View File

@ -195,7 +195,7 @@ class MagnumObject(object):
fields = {
'created_at': obj_utils.datetime_or_str_or_none,
'updated_at': obj_utils.datetime_or_str_or_none,
}
}
obj_extra_fields = []
_attr_created_at_from_primitive = obj_utils.dt_deserializer
@ -404,7 +404,7 @@ class MagnumObject(object):
"""
for name in self.fields.keys() + self.obj_extra_fields:
if (hasattr(self, get_attrname(name)) or
name in self.obj_extra_fields):
name in self.obj_extra_fields):
yield name, getattr(self, name)
items = lambda self: list(self.iteritems())
@ -454,8 +454,8 @@ class MagnumObject(object):
def as_dict(self):
return dict((k, getattr(self, k))
for k in self.fields
if hasattr(self, k))
for k in self.fields
if hasattr(self, k))
class ObjectListBase(object):
@ -468,7 +468,7 @@ class ObjectListBase(object):
"""
fields = {
'objects': list,
}
}
# This is a dictionary of my_version:child_version mappings so that
# we can support backleveling our contents based on the version
@ -566,7 +566,7 @@ class MagnumObjectSerializer(messaging.NoOpSerializer):
entity = self._process_iterable(context, self.serialize_entity,
entity)
elif (hasattr(entity, 'obj_to_primitive') and
callable(entity.obj_to_primitive)):
callable(entity.obj_to_primitive)):
entity = entity.obj_to_primitive()
return entity

View File

@ -176,5 +176,5 @@ class Bay(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -106,9 +106,9 @@ class BayModel(base.MagnumObject):
"""
db_baymodels = cls.dbapi.get_baymodel_list(context, limit=limit,
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return BayModel._from_db_object_list(db_baymodels, cls, context)
@base.remotable
@ -178,5 +178,5 @@ class BayModel(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -85,9 +85,9 @@ class Container(base.MagnumObject):
"""
db_containers = cls.dbapi.get_container_list(context, limit=limit,
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Container._from_db_object_list(db_containers, cls, context)
@base.remotable
@ -157,5 +157,5 @@ class Container(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -85,9 +85,9 @@ class Node(base.MagnumObject):
"""
db_nodes = cls.dbapi.get_node_list(context, limit=limit,
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
marker=marker,
sort_key=sort_key,
sort_dir=sort_dir)
return Node._from_db_object_list(db_nodes, cls, context)
@base.remotable
@ -157,5 +157,5 @@ class Node(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -190,5 +190,5 @@ class Pod(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -55,8 +55,8 @@ class ReplicationController(base.MagnumObject):
@staticmethod
def _from_db_object_list(db_objects, cls, context):
"""Converts a list of database entities to a list of formal objects."""
return [ReplicationController._from_db_object(cls(context),
obj) for obj in db_objects]
return [ReplicationController._from_db_object(cls(context), obj)
for obj in db_objects]
@base.remotable_classmethod
def get_by_id(cls, context, rc_id):
@ -182,5 +182,5 @@ class ReplicationController(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]

View File

@ -179,5 +179,5 @@ class Service(base.MagnumObject):
current = self.__class__.get_by_uuid(self._context, uuid=self.uuid)
for field in self.fields:
if (hasattr(self, base.get_attrname(field)) and
self[field] != current[field]):
self[field] != current[field]):
self[field] = current[field]