MCPcopy Index your code
hub / github.com/python-pillow/Pillow / encode_to_pyfd

Method encode_to_pyfd

src/PIL/ImageFile.py:908–922  ·  view source on GitHub ↗

If ``pushes_fd`` is ``True``, then this method will be used, and ``encode()`` will only be called once. :returns: A tuple of ``(bytes consumed, errcode)``. Err codes are from :data:`.ImageFile.ERRORS`.

(self)

Source from the content-addressed store, hash-verified

906 raise NotImplementedError(msg)
907
908 def encode_to_pyfd(self) -> tuple[int, int]:
909 """
910 If ``pushes_fd`` is ``True``, then this method will be used,
911 and ``encode()`` will only be called once.
912
913 :returns: A tuple of ``(bytes consumed, errcode)``.
914 Err codes are from :data:`.ImageFile.ERRORS`.
915 """
916 if not self.pushes_fd:
917 return 0, -8 # bad configuration
918 bytes_consumed, errcode, data = self.encode(0)
919 if data:
920 assert self.fd is not None
921 self.fd.write(data)
922 return bytes_consumed, errcode
923
924 def encode_to_file(self, fh: int, bufsize: int) -> int:
925 """

Callers 2

test_encodeMethod · 0.95
_encode_tileFunction · 0.80

Calls 2

encodeMethod · 0.95
writeMethod · 0.45

Tested by 1

test_encodeMethod · 0.76