mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Remove redundant files
This commit is contained in:
parent
106fc4085f
commit
ebed90c228
|
@ -1,14 +0,0 @@
|
|||
import glob
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
sys.path.insert(0, ".")
|
||||
|
||||
for file in glob.glob("src/PIL/*.py"):
|
||||
module = os.path.basename(file)[:-3]
|
||||
try:
|
||||
exec("from PIL import " + module)
|
||||
except (ImportError, SyntaxError):
|
||||
print("===", "failed to import", module)
|
||||
traceback.print_exc()
|
|
@ -1,66 +0,0 @@
|
|||
# brute-force search for access descriptor hash table
|
||||
|
||||
modes = [
|
||||
"1",
|
||||
"L",
|
||||
"LA",
|
||||
"La",
|
||||
"I",
|
||||
"I;16",
|
||||
"I;16L",
|
||||
"I;16B",
|
||||
"I;32L",
|
||||
"I;32B",
|
||||
"F",
|
||||
"P",
|
||||
"PA",
|
||||
"RGB",
|
||||
"RGBA",
|
||||
"RGBa",
|
||||
"RGBX",
|
||||
"CMYK",
|
||||
"YCbCr",
|
||||
"LAB",
|
||||
"HSV",
|
||||
]
|
||||
|
||||
|
||||
def hash(s, i):
|
||||
# djb2 hash: multiply by 33 and xor character
|
||||
for c in s:
|
||||
i = (((i << 5) + i) ^ ord(c)) & 0xFFFFFFFF
|
||||
return i
|
||||
|
||||
|
||||
def check(size, i0):
|
||||
h = [None] * size
|
||||
for m in modes:
|
||||
i = hash(m, i0)
|
||||
i = i % size
|
||||
if h[i]:
|
||||
return 0
|
||||
h[i] = m
|
||||
return h
|
||||
|
||||
|
||||
min_start = 0
|
||||
|
||||
# 1) find the smallest table size with no collisions
|
||||
for min_size in range(len(modes), 16384):
|
||||
if check(min_size, 0):
|
||||
print(len(modes), "modes fit in", min_size, "slots")
|
||||
break
|
||||
|
||||
# 2) see if we can do better with a different initial value
|
||||
for i0 in range(65556):
|
||||
for size in range(1, min_size):
|
||||
if check(size, i0):
|
||||
if size < min_size:
|
||||
print(len(modes), "modes fit in", size, "slots with start", i0)
|
||||
min_size = size
|
||||
min_start = i0
|
||||
|
||||
print()
|
||||
|
||||
print("#define ACCESS_TABLE_SIZE", min_size)
|
||||
print("#define ACCESS_TABLE_HASH", min_start)
|
|
@ -1,57 +0,0 @@
|
|||
import io
|
||||
import queue
|
||||
import sys
|
||||
import threading
|
||||
import time
|
||||
|
||||
from PIL import Image
|
||||
|
||||
test_format = sys.argv[1] if len(sys.argv) > 1 else "PNG"
|
||||
|
||||
im = Image.open("Tests/images/hopper.ppm")
|
||||
im.load()
|
||||
|
||||
queue = queue.Queue()
|
||||
|
||||
result = []
|
||||
|
||||
|
||||
class Worker(threading.Thread):
|
||||
def run(self):
|
||||
while True:
|
||||
im = queue.get()
|
||||
if im is None:
|
||||
queue.task_done()
|
||||
sys.stdout.write("x")
|
||||
break
|
||||
f = io.BytesIO()
|
||||
im.save(f, test_format, optimize=1)
|
||||
data = f.getvalue()
|
||||
result.append(len(data))
|
||||
im = Image.open(io.BytesIO(data))
|
||||
im.load()
|
||||
sys.stdout.write(".")
|
||||
queue.task_done()
|
||||
|
||||
|
||||
t0 = time.time()
|
||||
|
||||
threads = 20
|
||||
jobs = 100
|
||||
|
||||
for i in range(threads):
|
||||
w = Worker()
|
||||
w.start()
|
||||
|
||||
for i in range(jobs):
|
||||
queue.put(im)
|
||||
|
||||
for i in range(threads):
|
||||
queue.put(None)
|
||||
|
||||
queue.join()
|
||||
|
||||
print()
|
||||
print(time.time() - t0)
|
||||
print(len(result), sum(result))
|
||||
print(result)
|
|
@ -1,26 +0,0 @@
|
|||
from PIL import Image
|
||||
|
||||
|
||||
def version(module, version):
|
||||
v = getattr(module.core, version + "_version", None)
|
||||
if v:
|
||||
print(version, v)
|
||||
|
||||
|
||||
version(Image, "jpeglib")
|
||||
version(Image, "zlib")
|
||||
version(Image, "libtiff")
|
||||
|
||||
try:
|
||||
from PIL import ImageFont
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
version(ImageFont, "freetype2")
|
||||
|
||||
try:
|
||||
from PIL import ImageCms
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
version(ImageCms, "littlecms")
|
Loading…
Reference in New Issue
Block a user