Implement __ne__ when __eq__ is defined
This commit is contained in:
parent
ec9436d7f6
commit
8ea6439d3b
@ -57,6 +57,8 @@ else:
|
||||
|
||||
def __new__(self, content):
|
||||
return str.__new__(self, self.transcode(content))
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
return str.__eq__(self, self.transcode(other))
|
||||
|
||||
|
@ -292,6 +292,8 @@ class Transform(object):
|
||||
return (xx1, xy1, yx1, yy1, dx1, dy1) < \
|
||||
(xx2, xy2, yx2, yy2, dx2, dy2)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
"""Transform instances are comparable:
|
||||
>>> t1 = Identity.scale(2, 3).translate(4, 6)
|
||||
|
@ -36,6 +36,8 @@ class DefaultTable(object):
|
||||
def __repr__(self):
|
||||
return "<'%s' table at %x>" % (self.tableTag, id(self))
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
|
@ -779,6 +779,8 @@ class Glyph(object):
|
||||
|
||||
self.data = data
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
@ -940,6 +942,8 @@ class GlyphComponent(object):
|
||||
self.transform = [[scale, 0], [0, scale]]
|
||||
self.flags = safeEval(attrs["flags"])
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
@ -1040,6 +1044,8 @@ class GlyphCoordinates(object):
|
||||
py = x * t[0][1] + y * t[1][1]
|
||||
self[i] = (px, py)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
|
@ -286,6 +286,8 @@ class OTTableWriter(object):
|
||||
# only works after self._doneWriting() has been called
|
||||
return hash(self.items)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
@ -673,6 +675,8 @@ class BaseTable(object):
|
||||
else:
|
||||
setattr(self, conv.name, value)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
@ -840,6 +844,8 @@ class ValueRecord(object):
|
||||
value.fromXML(name2, attrs2, content2, font)
|
||||
setattr(self, name, value)
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
def __eq__(self, other):
|
||||
if type(self) != type(other):
|
||||
raise TypeError("unordered types %s() < %s()", type(self), type(other))
|
||||
|
Loading…
x
Reference in New Issue
Block a user