mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Removed ImageFileIO, deprecated since PIL
This commit is contained in:
parent
3841a11fb5
commit
a3107af63f
|
@ -1,40 +0,0 @@
|
||||||
#
|
|
||||||
# The Python Imaging Library.
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# kludge to get basic ImageFileIO functionality
|
|
||||||
#
|
|
||||||
# History:
|
|
||||||
# 1998-08-06 fl Recreated
|
|
||||||
#
|
|
||||||
# Copyright (c) Secret Labs AB 1998-2002.
|
|
||||||
#
|
|
||||||
# See the README file for information on usage and redistribution.
|
|
||||||
#
|
|
||||||
"""
|
|
||||||
The **ImageFileIO** module can be used to read an image from a
|
|
||||||
socket, or any other stream device.
|
|
||||||
|
|
||||||
Deprecated. New code should use the :class:`PIL.ImageFile.Parser`
|
|
||||||
class in the :mod:`PIL.ImageFile` module instead.
|
|
||||||
|
|
||||||
.. seealso:: modules :class:`PIL.ImageFile.Parser`
|
|
||||||
"""
|
|
||||||
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
|
|
||||||
class ImageFileIO(BytesIO):
|
|
||||||
def __init__(self, fp):
|
|
||||||
"""
|
|
||||||
Adds buffering to a stream file object, in order to
|
|
||||||
provide **seek** and **tell** methods required
|
|
||||||
by the :func:`PIL.Image.Image.open` method. The stream object must
|
|
||||||
implement **read** and **close** methods.
|
|
||||||
|
|
||||||
:param fp: Stream file handle.
|
|
||||||
|
|
||||||
.. seealso:: modules :func:`PIL.Image.open`
|
|
||||||
"""
|
|
||||||
data = fp.read()
|
|
||||||
BytesIO.__init__(self, data)
|
|
|
@ -1,33 +0,0 @@
|
||||||
from helper import unittest, PillowTestCase, hopper, tostring
|
|
||||||
|
|
||||||
from PIL import Image
|
|
||||||
from PIL import ImageFileIO
|
|
||||||
|
|
||||||
|
|
||||||
class TestImageFileIo(PillowTestCase):
|
|
||||||
|
|
||||||
def test_fileio(self):
|
|
||||||
|
|
||||||
class DumbFile(object):
|
|
||||||
def __init__(self, data):
|
|
||||||
self.data = data
|
|
||||||
|
|
||||||
def read(self, bytes=None):
|
|
||||||
assert(bytes is None)
|
|
||||||
return self.data
|
|
||||||
|
|
||||||
def close(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
im1 = hopper()
|
|
||||||
|
|
||||||
io = ImageFileIO.ImageFileIO(DumbFile(tostring(im1, "PPM")))
|
|
||||||
|
|
||||||
im2 = Image.open(io)
|
|
||||||
self.assert_image_equal(im1, im2)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
||||||
|
|
||||||
# End of file
|
|
|
@ -64,15 +64,6 @@ can be found here.
|
||||||
|
|
||||||
.. intentionally skipped documenting this because it's deprecated
|
.. intentionally skipped documenting this because it's deprecated
|
||||||
|
|
||||||
:mod:`ImageFileIO` Module
|
|
||||||
-------------------------
|
|
||||||
|
|
||||||
.. automodule:: PIL.ImageFileIO
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
|
|
||||||
:mod:`ImageShow` Module
|
:mod:`ImageShow` Module
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user