mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
py3k: __nonzero__ is now __bool__
This commit is contained in:
parent
3a665a7835
commit
eed042fae5
|
@ -17,6 +17,7 @@
|
|||
|
||||
import Image
|
||||
import _imagingmath
|
||||
import sys
|
||||
|
||||
VERBOSE = 0
|
||||
|
||||
|
@ -84,9 +85,15 @@ class _Operand:
|
|||
return _Operand(out)
|
||||
|
||||
# unary operators
|
||||
def __nonzero__(self):
|
||||
# an image is "true" if it contains at least one non-zero pixel
|
||||
return self.im.getbbox() is not None
|
||||
if sys.version_info >= (3,0):
|
||||
def __bool__(self):
|
||||
# an image is "true" if it contains at least one non-zero pixel
|
||||
return self.im.getbbox() is not None
|
||||
else:
|
||||
def __nonzero__(self):
|
||||
# an image is "true" if it contains at least one non-zero pixel
|
||||
return self.im.getbbox() is not None
|
||||
|
||||
def __abs__(self):
|
||||
return self.apply("abs", self)
|
||||
def __pos__(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user