Merge "Add __hash__ functions where necessary"

This commit is contained in:
Jenkins 2015-07-03 02:59:30 +00:00 committed by Gerrit Code Review
commit 2422dfcd30
4 changed files with 16 additions and 0 deletions

View File

@ -125,6 +125,9 @@ class Function(object):
return NotImplemented
return not eq
def __hash__(self):
return id(self)
def resolve(snippet):
while isinstance(snippet, Function):

View File

@ -299,6 +299,9 @@ class Resource(object):
return result
return not result
def __hash__(self):
return id(self)
def metadata_get(self, refresh=False):
if refresh:
self._rsrc_metadata = None

View File

@ -395,6 +395,13 @@ class ResourceDefinition(ResourceDefinitionCore, collections.Mapping):
raise KeyError(key)
def __hash__(self):
"""
Return a hash of the ResourceDefinition object.
"""
warnings.warn(self._deprecation_msg, DeprecationWarning)
return super(ResourceDefinition, self).__hash__()
def __len__(self):
"""
Return the number of available CFN template keys.

View File

@ -126,6 +126,9 @@ class PhysName(object):
# ignore the stack portion of the name, as it may have been truncated
return res == self.res
def __hash__(self):
return id(self)
def __ne__(self, physical_name):
return not self.__eq__(physical_name)