mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #474 from sciunto/bool
Maint: minor patch on booleans + travis
This commit is contained in:
commit
5750d5d6ef
|
@ -93,7 +93,7 @@ def Ghostscript(tile, size, fp, scale=1):
|
||||||
]
|
]
|
||||||
|
|
||||||
if gs_windows_binary is not None:
|
if gs_windows_binary is not None:
|
||||||
if gs_windows_binary is False:
|
if not gs_windows_binary:
|
||||||
raise WindowsError('Unable to locate Ghostscript on paths')
|
raise WindowsError('Unable to locate Ghostscript on paths')
|
||||||
command[0] = gs_windows_binary
|
command[0] = gs_windows_binary
|
||||||
|
|
||||||
|
|
|
@ -248,7 +248,7 @@ class OleFileIO:
|
||||||
if entry[1:2] == "Image":
|
if entry[1:2] == "Image":
|
||||||
fin = ole.openstream(entry)
|
fin = ole.openstream(entry)
|
||||||
fout = open(entry[0:1], "wb")
|
fout = open(entry[0:1], "wb")
|
||||||
while 1:
|
while True:
|
||||||
s = fin.read(8192)
|
s = fin.read(8192)
|
||||||
if not s:
|
if not s:
|
||||||
break
|
break
|
||||||
|
|
|
@ -182,7 +182,7 @@ class SpiderImageFile(ImageFile.ImageFile):
|
||||||
# given a list of filenames, return a list of images
|
# given a list of filenames, return a list of images
|
||||||
def loadImageSeries(filelist=None):
|
def loadImageSeries(filelist=None):
|
||||||
" create a list of Image.images for use in montage "
|
" create a list of Image.images for use in montage "
|
||||||
if filelist == None or len(filelist) < 1:
|
if filelist is None or len(filelist) < 1:
|
||||||
return
|
return
|
||||||
|
|
||||||
imglist = []
|
imglist = []
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ def _save(im, fp, filename):
|
||||||
# print (im.mode, compression, a, im.encoderconfig)
|
# print (im.mode, compression, a, im.encoderconfig)
|
||||||
e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
|
e = Image._getencoder(im.mode, 'libtiff', a, im.encoderconfig)
|
||||||
e.setimage(im.im, (0,0)+im.size)
|
e.setimage(im.im, (0,0)+im.size)
|
||||||
while 1:
|
while True:
|
||||||
l, s, d = e.encode(16*1024) # undone, change to self.decodermaxblock
|
l, s, d = e.encode(16*1024) # undone, change to self.decodermaxblock
|
||||||
if not _fp:
|
if not _fp:
|
||||||
fp.write(d)
|
fp.write(d)
|
||||||
|
|
|
@ -47,7 +47,7 @@ TEST_misc = False
|
||||||
#######################################################################
|
#######################################################################
|
||||||
def outputImage(im, funcName = None):
|
def outputImage(im, funcName = None):
|
||||||
# save or display the image, depending on value of SHOW_IMAGES
|
# save or display the image, depending on value of SHOW_IMAGES
|
||||||
if SHOW == True:
|
if SHOW:
|
||||||
im.show()
|
im.show()
|
||||||
else:
|
else:
|
||||||
im.save(os.path.join(OUTPUTDIR, "%s.tif" %funcName))
|
im.save(os.path.join(OUTPUTDIR, "%s.tif" %funcName))
|
||||||
|
@ -57,7 +57,7 @@ def outputImage(im, funcName = None):
|
||||||
# The tests themselves
|
# The tests themselves
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
if TEST_error_catching == True:
|
if TEST_error_catching:
|
||||||
im = Image.open(IMAGE)
|
im = Image.open(IMAGE)
|
||||||
try:
|
try:
|
||||||
#neither of these proifles exists (unless you make them), so we should
|
#neither of these proifles exists (unless you make them), so we should
|
||||||
|
@ -70,7 +70,7 @@ if TEST_error_catching == True:
|
||||||
print("error catching test completed successfully (if you see the message \
|
print("error catching test completed successfully (if you see the message \
|
||||||
above that we caught the error).")
|
above that we caught the error).")
|
||||||
|
|
||||||
if TEST_profileToProfile == True:
|
if TEST_profileToProfile:
|
||||||
# open the image file using the standard PIL function Image.open()
|
# open the image file using the standard PIL function Image.open()
|
||||||
im = Image.open(IMAGE)
|
im = Image.open(IMAGE)
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ if TEST_profileToProfile == True:
|
||||||
|
|
||||||
print("profileToProfile test completed successfully.")
|
print("profileToProfile test completed successfully.")
|
||||||
|
|
||||||
if TEST_profileToProfile_inPlace == True:
|
if TEST_profileToProfile_inPlace:
|
||||||
# we'll do the same test as profileToProfile, but modify im in place
|
# we'll do the same test as profileToProfile, but modify im in place
|
||||||
# instead of getting a new image returned to us
|
# instead of getting a new image returned to us
|
||||||
im = Image.open(IMAGE)
|
im = Image.open(IMAGE)
|
||||||
|
@ -94,7 +94,7 @@ if TEST_profileToProfile_inPlace == True:
|
||||||
outputMode = OUTMODE, inPlace = True)
|
outputMode = OUTMODE, inPlace = True)
|
||||||
|
|
||||||
# now that the image is converted, save or display it
|
# now that the image is converted, save or display it
|
||||||
if result == None:
|
if result is None:
|
||||||
# this is the normal result when modifying in-place
|
# this is the normal result when modifying in-place
|
||||||
outputImage(im, "profileToProfile_inPlace")
|
outputImage(im, "profileToProfile_inPlace")
|
||||||
else:
|
else:
|
||||||
|
@ -103,7 +103,7 @@ if TEST_profileToProfile_inPlace == True:
|
||||||
|
|
||||||
print("profileToProfile in-place test completed successfully.")
|
print("profileToProfile in-place test completed successfully.")
|
||||||
|
|
||||||
if TEST_buildTransform == True:
|
if TEST_buildTransform:
|
||||||
# make a transform using the input and output profile path strings
|
# make a transform using the input and output profile path strings
|
||||||
transform = ImageCms.buildTransform(INPUT_PROFILE, OUTPUT_PROFILE, INMODE, \
|
transform = ImageCms.buildTransform(INPUT_PROFILE, OUTPUT_PROFILE, INMODE, \
|
||||||
OUTMODE)
|
OUTMODE)
|
||||||
|
@ -126,7 +126,7 @@ if TEST_buildTransform == True:
|
||||||
# Python should also do this automatically when it goes out of scope.
|
# Python should also do this automatically when it goes out of scope.
|
||||||
del(transform)
|
del(transform)
|
||||||
|
|
||||||
if TEST_buildTransformFromOpenProfiles == True:
|
if TEST_buildTransformFromOpenProfiles:
|
||||||
# we'll actually test a couple profile open/creation functions here too
|
# we'll actually test a couple profile open/creation functions here too
|
||||||
|
|
||||||
# first, get a handle to an input profile, in this case we'll create
|
# first, get a handle to an input profile, in this case we'll create
|
||||||
|
@ -160,7 +160,7 @@ if TEST_buildTransformFromOpenProfiles == True:
|
||||||
del(outputProfile)
|
del(outputProfile)
|
||||||
del(transform)
|
del(transform)
|
||||||
|
|
||||||
if TEST_buildProofTransform == True:
|
if TEST_buildProofTransform:
|
||||||
# make a transform using the input and output and proof profile path
|
# make a transform using the input and output and proof profile path
|
||||||
# strings
|
# strings
|
||||||
# images converted with this transform will simulate the appearance
|
# images converted with this transform will simulate the appearance
|
||||||
|
@ -188,7 +188,7 @@ if TEST_buildProofTransform == True:
|
||||||
# Python should also do this automatically when it goes out of scope.
|
# Python should also do this automatically when it goes out of scope.
|
||||||
del(transform)
|
del(transform)
|
||||||
|
|
||||||
if TEST_getProfileInfo == True:
|
if TEST_getProfileInfo:
|
||||||
# get a profile handle
|
# get a profile handle
|
||||||
profile = ImageCms.getOpenProfile(INPUT_PROFILE)
|
profile = ImageCms.getOpenProfile(INPUT_PROFILE)
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ if TEST_getProfileInfo == True:
|
||||||
|
|
||||||
print("getProfileInfo test completed successfully.")
|
print("getProfileInfo test completed successfully.")
|
||||||
|
|
||||||
if TEST_misc == True:
|
if TEST_misc:
|
||||||
# test the versions, about, and copyright functions
|
# test the versions, about, and copyright functions
|
||||||
print("Versions: %s" %str(ImageCms.versions()))
|
print("Versions: %s" %str(ImageCms.versions()))
|
||||||
print("About:\n\n%s" %ImageCms.about())
|
print("About:\n\n%s" %ImageCms.about())
|
||||||
|
|
|
@ -4,10 +4,10 @@ from PIL import Image, EpsImagePlugin
|
||||||
import sys
|
import sys
|
||||||
import io
|
import io
|
||||||
|
|
||||||
if EpsImagePlugin.gs_windows_binary == False:
|
if not EpsImagePlugin.gs_windows_binary:
|
||||||
# already checked. Not there.
|
# already checked. Not there.
|
||||||
skip()
|
skip()
|
||||||
|
|
||||||
if not sys.platform.startswith('win'):
|
if not sys.platform.startswith('win'):
|
||||||
import subprocess
|
import subprocess
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -18,7 +18,7 @@ result = []
|
||||||
|
|
||||||
class Worker(threading.Thread):
|
class Worker(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
while 1:
|
while True:
|
||||||
im = queue.get()
|
im = queue.get()
|
||||||
if im is None:
|
if im is None:
|
||||||
queue.task_done()
|
queue.task_done()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user