mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
review lint
This commit is contained in:
parent
c2cd5fe3d1
commit
38f43c1e5f
|
@ -619,7 +619,7 @@ class PyDecoder(object):
|
||||||
self.state.ysize = y1 - y0
|
self.state.ysize = y1 - y0
|
||||||
|
|
||||||
if self.state.xsize <= 0 or self.state.ysize <= 0:
|
if self.state.xsize <= 0 or self.state.ysize <= 0:
|
||||||
raise ValueError("Size Cannot be Negative")
|
raise ValueError("Size cannot be negative")
|
||||||
|
|
||||||
if (self.state.xsize + self.state.xoff > self.im.size[0] or
|
if (self.state.xsize + self.state.xoff > self.im.size[0] or
|
||||||
self.state.ysize + self.state.yoff > self.im.size[1]):
|
self.state.ysize + self.state.yoff > self.im.size[1]):
|
||||||
|
|
|
@ -113,7 +113,6 @@ class MspDecoder(ImageFile.PyDecoder):
|
||||||
img = io.BytesIO()
|
img = io.BytesIO()
|
||||||
blank_line = bytearray((0xff,)*((self.state.xsize+7)//8))
|
blank_line = bytearray((0xff,)*((self.state.xsize+7)//8))
|
||||||
try:
|
try:
|
||||||
last_pos = 0
|
|
||||||
self.fd.seek(32)
|
self.fd.seek(32)
|
||||||
rowmap = struct.unpack_from("<%dH" % (self.state.ysize),
|
rowmap = struct.unpack_from("<%dH" % (self.state.ysize),
|
||||||
self.fd.read(self.state.ysize*2))
|
self.fd.read(self.state.ysize*2))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from helper import unittest, PillowTestCase, hopper
|
from helper import unittest, PillowTestCase, hopper
|
||||||
|
|
||||||
from PIL import Image, ImageFile, MspImagePlugin
|
from PIL import Image, MspImagePlugin
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
|
@ -26,14 +26,14 @@ Pillow decodes files in 2 stages:
|
||||||
called, which sets up a decoder for each tile and feeds the data to
|
called, which sets up a decoder for each tile and feeds the data to
|
||||||
it.
|
it.
|
||||||
|
|
||||||
A image plug-in should contain a format handler derived from the
|
An image plug-in should contain a format handler derived from the
|
||||||
:py:class:`PIL.ImageFile.ImageFile` base class. This class should
|
:py:class:`PIL.ImageFile.ImageFile` base class. This class should
|
||||||
provide an :py:meth:`_open` method, which reads the file header and
|
provide an :py:meth:`_open` method, which reads the file header and
|
||||||
sets up at least the :py:attr:`~PIL.Image.Image.mode` and
|
sets up at least the :py:attr:`~PIL.Image.Image.mode` and
|
||||||
:py:attr:`~PIL.Image.Image.size` attributes. To be able to load the
|
:py:attr:`~PIL.Image.Image.size` attributes. To be able to load the
|
||||||
file, the method must also create a list of :py:attr:`tile`
|
file, the method must also create a list of :py:attr:`tile`
|
||||||
descriptors, which contain a decoder name, extents of the tile, and
|
descriptors, which contain a decoder name, extents of the tile, and
|
||||||
any decoder specific data. The format handler class must be explicitly
|
any decoder-specific data. The format handler class must be explicitly
|
||||||
registered, via a call to the :py:mod:`~PIL.Image` module.
|
registered, via a call to the :py:mod:`~PIL.Image` module.
|
||||||
|
|
||||||
.. note:: For performance reasons, it is important that the
|
.. note:: For performance reasons, it is important that the
|
||||||
|
@ -403,8 +403,8 @@ Python file decoders should derive from
|
||||||
:py:class:`PIL.ImageFile.PyDecoder` and should at least override the
|
:py:class:`PIL.ImageFile.PyDecoder` and should at least override the
|
||||||
decode method. File decoders should be registered using
|
decode method. File decoders should be registered using
|
||||||
:py:meth:`PIL.Image.register_decoder`. As in the C implementation of
|
:py:meth:`PIL.Image.register_decoder`. As in the C implementation of
|
||||||
the file decoders, there are three stages in the lifetime of a Python
|
the file decoders, there are three stages in the lifetime of a
|
||||||
based file decoder:
|
Python-based file decoder:
|
||||||
|
|
||||||
1. Setup: Pillow looks for the decoder in the registry, then
|
1. Setup: Pillow looks for the decoder in the registry, then
|
||||||
instantiates the class.
|
instantiates the class.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user