imagefile flags added

This commit is contained in:
Deekshu Kare 2024-06-21 23:16:51 +02:00
parent f18d64c267
commit 4f31cd7a31
2 changed files with 14 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from PIL import Image
from PIL import PdfParser
from PIL import ImageCms
from PIL import McIdasImagePlugin
from PIL import ImageFile
pytest_plugins = ["Tests.helper"]
@ -16,6 +17,7 @@ def calculate_coverage(test_name):
"branches2": PdfParser.XrefTable.branches,
"branches3": ImageCms.ImageCmsProfile.branches,
"branches4": McIdasImagePlugin.McIdasImageFile.branches,
"branches5": ImageFile.PyEncoder.branches,
# Add more
}

View File

@ -39,6 +39,11 @@ from . import Image
from ._deprecate import deprecate
from ._util import is_path
branches = {
"1": False,
"2": False,
}
MAXBLOCK = 65536
SAFEBLOCK = 1024 * 1024
@ -750,6 +755,11 @@ class PyDecoder(PyCodec):
class PyEncoder(PyCodec):
branches = {
"1": False,
"2": False,
}
"""
Python implementation of a format encoder. Override this class and
add the decoding logic in the :meth:`encode` method.
@ -801,7 +811,9 @@ class PyEncoder(PyCodec):
"""
errcode = 0
while errcode == 0:
PyEncoder.branches["1"] = True
status, errcode, buf = self.encode(bufsize)
if status > 0:
PyEncoder.branches["2"] = True
fh.write(buf[status:])
return errcode