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