Skip to content

Commit

Permalink
review lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredfool committed Feb 23, 2017
1 parent 583f58f commit dc976ea
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions PIL/ImageFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def setimage(self, im, extents=None):
(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
Expand All @@ -619,7 +619,7 @@ def setimage(self, im, extents=None):
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]):
Expand Down
15 changes: 7 additions & 8 deletions PIL/MspImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -113,7 +113,6 @@ def decode(self, buffer):
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))
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_file_msp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from helper import unittest, PillowTestCase, hopper

from PIL import Image, ImageFile, MspImagePlugin
from PIL import Image, MspImagePlugin

import os

Expand Down
8 changes: 4 additions & 4 deletions docs/handbook/writing-your-own-file-decoder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit dc976ea

Please sign in to comment.