Make IFDRational hashable

This commit is contained in:
wiredfool 2015-10-25 14:49:52 +00:00
parent 3bbb9e676f
commit f9fe4da8b2

View File

@ -283,6 +283,9 @@ class IFDRational(Fraction):
def __repr__(self):
return str(float(self._val))
def __hash__(self):
return self._val.__hash__()
def __eq__(self,other):
if type(other) == float:
return float(self) == other
@ -291,6 +294,7 @@ class IFDRational(Fraction):
return float(self) == float(other)
class ImageFileDirectory_v2(collections.MutableMapping):
"""This class represents a TIFF tag directory. To speed things up, we
don't decode tags unless they're asked for.