review lint

This commit is contained in:
wiredfool 2017-02-23 02:20:25 -08:00
parent c2cd5fe3d1
commit 38f43c1e5f
4 changed files with 14 additions and 15 deletions

View File

@ -610,7 +610,7 @@ class PyDecoder(object):
(x0, y0, x1, y1) = (0, 0, 0, 0)
if x0 ==0 and x1 ==0:
if x0 == 0 and x1 == 0:
self.state.xsize, self.state.ysize = self.im.size
else:
self.state.xoff = x0
@ -619,7 +619,7 @@ class PyDecoder(object):
self.state.ysize = y1 - y0
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
self.state.ysize + self.state.yoff > self.im.size[1]):

View File

@ -90,13 +90,13 @@ class MspDecoder(ImageFile.PyDecoder):
#
# Pseudocode of the decoder:
# Read a BYTE value as the RunType
# If the RunType value is zero
# Read next byte as the RunCount
# Read the next byte as the RunValue
# Write the RunValue byte RunCount times
# If the RunType value is non-zero
# Use this value as the RunCount
# Read and write the next RunCount bytes literally
# If the RunType value is zero
# Read next byte as the RunCount
# Read the next byte as the RunValue
# Write the RunValue byte RunCount times
# If the RunType value is non-zero
# Use this value as the RunCount
# Read and write the next RunCount bytes literally
#
# e.g.:
# 0x00 03 ff 05 00 01 02 03 04
@ -113,7 +113,6 @@ class MspDecoder(ImageFile.PyDecoder):
img = io.BytesIO()
blank_line = bytearray((0xff,)*((self.state.xsize+7)//8))
try:
last_pos = 0
self.fd.seek(32)
rowmap = struct.unpack_from("<%dH" % (self.state.ysize),
self.fd.read(self.state.ysize*2))

View File

@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase, hopper
from PIL import Image, ImageFile, MspImagePlugin
from PIL import Image, MspImagePlugin
import os

View File

@ -26,14 +26,14 @@ Pillow decodes files in 2 stages:
called, which sets up a decoder for each tile and feeds the data to
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
provide an :py:meth:`_open` method, which reads the file header 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
file, the method must also create a list of :py:attr:`tile`
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.
.. 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
decode method. File decoders should be registered using
: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
based file decoder:
the file decoders, there are three stages in the lifetime of a
Python-based file decoder:
1. Setup: Pillow looks for the decoder in the registry, then
instantiates the class.