lisa.utils.SimpleHash#
- class lisa.utils.SimpleHash[source]#
Bases:
objectBase class providing a basic implementation of
__eq__and__hash__: two instances are equal if their__dict__and__class__attributes are equal.Methods
Used to coerce the values of
self.__dict__to hashable values.
Methods#
- SimpleHash.HASH_COERCE(x, coerce)[source]#
Used to coerce the values of
self.__dict__to hashable values.- Parameters:
x (object) – the value to coerce to a hashable value
coerce (collections.abc.Callable) –
Function to be used to recurse, rather than
self.HASH_COERCE. This takes care of memoization to avoid infinite recursion.Attention
The
coercefunction should only be called on values that will be alive after the call has ended, i.e. it can only be passed parts of thexstructure. If temporary objects are passed, memoization will not work as it relies onid(), which is only guaranteed to provide unique ID to objects that are alive.