Fix trailing whitespace
This commit is contained in:
@@ -29,12 +29,12 @@ def LogIf(condition, message):
|
|||||||
|
|
||||||
def IsPrimitiveType(obj):
|
def IsPrimitiveType(obj):
|
||||||
"""See if the passed in type is a Primitive Type"""
|
"""See if the passed in type is a Primitive Type"""
|
||||||
return (isinstance(obj, types.bool) or isinstance(obj, types.byte) or
|
return (isinstance(obj, types.bool) or isinstance(obj, types.byte) or
|
||||||
isinstance(obj, types.short) or isinstance(obj, types.int) or
|
isinstance(obj, types.short) or isinstance(obj, types.int) or
|
||||||
isinstance(obj, types.double) or isinstance(obj, types.float) or
|
isinstance(obj, types.double) or isinstance(obj, types.float) or
|
||||||
isinstance(obj, types.long) or isinstance(obj, types.str) or
|
isinstance(obj, types.long) or isinstance(obj, types.str) or
|
||||||
isinstance(obj, unicode) or
|
isinstance(obj, unicode) or
|
||||||
isinstance(obj, types.PropertyPath) or
|
isinstance(obj, types.PropertyPath) or
|
||||||
isinstance(obj, types.ManagedMethod) or
|
isinstance(obj, types.ManagedMethod) or
|
||||||
isinstance(obj, types.datetime) or
|
isinstance(obj, types.datetime) or
|
||||||
isinstance(obj, types.URI) or isinstance(obj, type))
|
isinstance(obj, types.URI) or isinstance(obj, type))
|
||||||
@@ -94,13 +94,13 @@ class Differ:
|
|||||||
def DiffDoArrays(self, oldObj, newObj, isElementLinks):
|
def DiffDoArrays(self, oldObj, newObj, isElementLinks):
|
||||||
"""Diff two DataObject arrays"""
|
"""Diff two DataObject arrays"""
|
||||||
if len(oldObj) != len(newObj):
|
if len(oldObj) != len(newObj):
|
||||||
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
for i, j in itertools.izip(oldObj, newObj):
|
for i, j in itertools.izip(oldObj, newObj):
|
||||||
if isElementLinks:
|
if isElementLinks:
|
||||||
if i.GetKey() != j.GetKey():
|
if i.GetKey() != j.GetKey():
|
||||||
__Log__.debug('DiffDoArrays: Keys do not match %s != %s'
|
__Log__.debug('DiffDoArrays: Keys do not match %s != %s'
|
||||||
% (i.GetKey(), j.GetKey()))
|
% (i.GetKey(), j.GetKey()))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
@@ -113,7 +113,7 @@ class Differ:
|
|||||||
def DiffAnyArrays(self, oldObj, newObj, isElementLinks):
|
def DiffAnyArrays(self, oldObj, newObj, isElementLinks):
|
||||||
"""Diff two arrays which contain Any objects"""
|
"""Diff two arrays which contain Any objects"""
|
||||||
if len(oldObj) != len(newObj):
|
if len(oldObj) != len(newObj):
|
||||||
__Log__.debug('DiffAnyArrays: Array lengths do not match. %d != %d'
|
__Log__.debug('DiffAnyArrays: Array lengths do not match. %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
for i, j in itertools.izip(oldObj, newObj):
|
for i, j in itertools.izip(oldObj, newObj):
|
||||||
@@ -125,7 +125,7 @@ class Differ:
|
|||||||
def DiffPrimitiveArrays(self, oldObj, newObj):
|
def DiffPrimitiveArrays(self, oldObj, newObj):
|
||||||
"""Diff two primitive arrays"""
|
"""Diff two primitive arrays"""
|
||||||
if len(oldObj) != len(newObj):
|
if len(oldObj) != len(newObj):
|
||||||
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
__Log__.debug('DiffDoArrays: Array lengths do not match %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
match = True
|
match = True
|
||||||
@@ -152,7 +152,7 @@ class Differ:
|
|||||||
if not oldObj or not newObj:
|
if not oldObj or not newObj:
|
||||||
return False
|
return False
|
||||||
if len(oldObj) != len(newObj):
|
if len(oldObj) != len(newObj):
|
||||||
__Log__.debug('DiffArrayObjects: Array lengths do not match %d != %d'
|
__Log__.debug('DiffArrayObjects: Array lengths do not match %d != %d'
|
||||||
% (len(oldObj), len(newObj)))
|
% (len(oldObj), len(newObj)))
|
||||||
return False
|
return False
|
||||||
firstObj = oldObj[0]
|
firstObj = oldObj[0]
|
||||||
@@ -164,8 +164,8 @@ class Differ:
|
|||||||
return self.DiffDoArrays(oldObj, newObj, isElementLinks)
|
return self.DiffDoArrays(oldObj, newObj, isElementLinks)
|
||||||
else:
|
else:
|
||||||
raise TypeError("Unknown type: %s" % oldObj.__class__)
|
raise TypeError("Unknown type: %s" % oldObj.__class__)
|
||||||
|
|
||||||
|
|
||||||
def DiffDataObjects(self, oldObj, newObj):
|
def DiffDataObjects(self, oldObj, newObj):
|
||||||
"""Diff Data Objects"""
|
"""Diff Data Objects"""
|
||||||
if oldObj == newObj:
|
if oldObj == newObj:
|
||||||
@@ -177,7 +177,7 @@ class Differ:
|
|||||||
newType = Type(newObj)
|
newType = Type(newObj)
|
||||||
if oldType != newType:
|
if oldType != newType:
|
||||||
__Log__.debug(
|
__Log__.debug(
|
||||||
'DiffDataObjects: Types do not match for dataobjects. %s != %s'
|
'DiffDataObjects: Types do not match for dataobjects. %s != %s'
|
||||||
% (oldObj._wsdlName, newObj._wsdlName))
|
% (oldObj._wsdlName, newObj._wsdlName))
|
||||||
return False
|
return False
|
||||||
for prop in oldObj._GetPropertyList():
|
for prop in oldObj._GetPropertyList():
|
||||||
@@ -186,12 +186,12 @@ class Differ:
|
|||||||
propType = oldObj._GetPropertyInfo(prop.name).type
|
propType = oldObj._GetPropertyInfo(prop.name).type
|
||||||
if not oldProp and not newProp:
|
if not oldProp and not newProp:
|
||||||
continue
|
continue
|
||||||
elif ((prop.flags & VmomiSupport.F_OPTIONAL) and
|
elif ((prop.flags & VmomiSupport.F_OPTIONAL) and
|
||||||
self._looseMatch and (not newProp or not oldProp)):
|
self._looseMatch and (not newProp or not oldProp)):
|
||||||
continue
|
continue
|
||||||
elif not oldProp or not newProp:
|
elif not oldProp or not newProp:
|
||||||
__Log__.debug(
|
__Log__.debug(
|
||||||
'DiffDataObjects: One of the objects has property %s unset'
|
'DiffDataObjects: One of the objects has property %s unset'
|
||||||
% prop.name)
|
% prop.name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -199,24 +199,24 @@ class Differ:
|
|||||||
if IsPrimitiveType(oldProp):
|
if IsPrimitiveType(oldProp):
|
||||||
bMatch = oldProp == newProp
|
bMatch = oldProp == newProp
|
||||||
elif isinstance(oldProp, types.ManagedObject):
|
elif isinstance(oldProp, types.ManagedObject):
|
||||||
bMatch = self.DiffAnyObjects(oldProp, newProp, prop.flags
|
bMatch = self.DiffAnyObjects(oldProp, newProp, prop.flags
|
||||||
& VmomiSupport.F_LINK)
|
& VmomiSupport.F_LINK)
|
||||||
elif isinstance(oldProp, types.DataObject):
|
elif isinstance(oldProp, types.DataObject):
|
||||||
if prop.flags & VmomiSupport.F_LINK:
|
if prop.flags & VmomiSupport.F_LINK:
|
||||||
bMatch = oldObj.GetKey() == newObj.GetKey()
|
bMatch = oldObj.GetKey() == newObj.GetKey()
|
||||||
LogIf(not bMatch, 'DiffDataObjects: Key match failed %s != %s'
|
LogIf(not bMatch, 'DiffDataObjects: Key match failed %s != %s'
|
||||||
% (oldObj.GetKey(), newObj.GetKey()))
|
% (oldObj.GetKey(), newObj.GetKey()))
|
||||||
else:
|
else:
|
||||||
bMatch = self.DiffAnyObjects(oldProp, newProp, prop.flags
|
bMatch = self.DiffAnyObjects(oldProp, newProp, prop.flags
|
||||||
& VmomiSupport.F_LINK)
|
& VmomiSupport.F_LINK)
|
||||||
elif isinstance(oldProp, list):
|
elif isinstance(oldProp, list):
|
||||||
bMatch = self.DiffArrayObjects(oldProp, newProp, prop.flags
|
bMatch = self.DiffArrayObjects(oldProp, newProp, prop.flags
|
||||||
& VmomiSupport.F_LINK)
|
& VmomiSupport.F_LINK)
|
||||||
else:
|
else:
|
||||||
raise TypeError("Unknown type: "+repr(propType))
|
raise TypeError("Unknown type: "+repr(propType))
|
||||||
|
|
||||||
if not bMatch:
|
if not bMatch:
|
||||||
__Log__.debug('DiffDataObjects: Objects differ in property %s'
|
__Log__.debug('DiffDataObjects: Objects differ in property %s'
|
||||||
% prop.name)
|
% prop.name)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
Reference in New Issue
Block a user