Simplifies __ne__ in BaseModel
This change uses 'not __eq__' to implement __ne__ preventing execeptions from being raised when obj passed in does not have __dict__. Example are instances of tuple, string, int, float, bool... Change-Id: Idf82eeeb865a121d5c81c5654e7c21e71e555238
This commit is contained in:
parent
57ad10c550
commit
67353ed226
@ -141,13 +141,7 @@ class BaseModel(object):
|
||||
return False
|
||||
|
||||
def __ne__(self, obj):
|
||||
if obj is None:
|
||||
return True
|
||||
|
||||
if vars(obj) == vars(self):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
return not self.__eq__(obj)
|
||||
|
||||
def __str__(self):
|
||||
strng = '<{0} object> {1}'.format(
|
||||
|
Loading…
x
Reference in New Issue
Block a user