mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-26 15:14:45 +03:00
Type annotations: Adjust __repr__ return & ignore ne/eq.
This commit is contained in:
parent
bd4e593682
commit
cd26623083
|
@ -667,7 +667,7 @@ class Image(object):
|
||||||
|
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other): # type: ignore # type: (Image) -> bool
|
||||||
# type: (Image) -> bool
|
# type: (Image) -> bool
|
||||||
return (isinstance(other, Image) and
|
return (isinstance(other, Image) and
|
||||||
self.__class__.__name__ == other.__class__.__name__ and
|
self.__class__.__name__ == other.__class__.__name__ and
|
||||||
|
@ -679,13 +679,12 @@ class Image(object):
|
||||||
self.getpalette() == other.getpalette() and
|
self.getpalette() == other.getpalette() and
|
||||||
self.tobytes() == other.tobytes())
|
self.tobytes() == other.tobytes())
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other): # type: ignore # type: (Image) -> bool
|
||||||
# type: (Image) -> bool
|
|
||||||
eq = (self == other)
|
eq = (self == other)
|
||||||
return not eq
|
return not eq
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
# type: () -> Text
|
# type: () -> str
|
||||||
return "<%s.%s image mode=%s size=%dx%d at 0x%X>" % (
|
return "<%s.%s image mode=%s size=%dx%d at 0x%X>" % (
|
||||||
self.__class__.__module__, self.__class__.__name__,
|
self.__class__.__module__, self.__class__.__name__,
|
||||||
self.mode, self.size[0], self.size[1],
|
self.mode, self.size[0], self.size[1],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user