Permalink
Browse files

PEP8: Remove trailing whitespace

  • Loading branch information...
mduggan committed Nov 7, 2013
1 parent 9ff6aa0 commit c1da8b835c6fe3c3e992a8c426efcadbbd5a0336
View
@@ -16,13 +16,13 @@ def ascii85decode(data):
letters, using 85 different types of characters (as 256**4 < 85**5).
When the length of the original bytes is not a multiple of 4, a special
rule is used for round up.
-
+
The Adobe's ASCII85 implementation is slightly different from
its original in handling the last characters.
-
+
The sample string is taken from:
http://en.wikipedia.org/w/index.php?title=Ascii85
-
+
>>> ascii85decode('9jqo^BlbD-BleB1DJ+*+F(f,q')
'Man is distinguished'
>>> ascii85decode('E,9)oF*2M7/c~>')
@@ -60,7 +60,7 @@ def asciihexdecode(data):
EOD. Any other characters will cause an error. If the filter encounters
the EOD marker after reading an odd number of hexadecimal digits, it
will behave as if a 0 followed the last digit.
-
+
>>> asciihexdecode('61 62 2e6364 65')
'ab.cde'
>>> asciihexdecode('61 62 2e6364 657>')
View
@@ -308,7 +308,7 @@ class CCITTG4Parser(BitParser):
BitParser.add(UNCOMPRESSED, 'T1000' , '0000000010')
BitParser.add(UNCOMPRESSED, 'T00000' , '00000000011')
BitParser.add(UNCOMPRESSED, 'T10000' , '00000000010')
-
+
class EOFB(Exception): pass
class InvalidData(Exception): pass
class ByteSkip(Exception): pass
@@ -386,7 +386,7 @@ def _parse_horiz2(self, n):
def _parse_uncompressed(self, bits):
if not bits: raise self.InvalidData
if bits.startswith('T'):
- self._accept = self._parse_mode
+ self._accept = self._parse_mode
self._color = int(bits[1])
self._do_uncompressed(bits[2:])
return self.MODE
@@ -418,14 +418,14 @@ def reset(self):
def output_line(self, y, bits):
print y, ''.join( str(b) for b in bits )
return
-
+
def _reset_line(self):
self._refline = self._curline
self._curline = array.array('b', [1]*self.width)
self._curpos = -1
self._color = 1
return
-
+
def _flush_line(self):
if self.width <= self._curpos:
self.output_line(self._y, self._curline)
@@ -460,7 +460,7 @@ def _do_vertical(self, dx):
self._curpos = x1
self._color = 1-self._color
return
-
+
def _do_pass(self):
#print '* pass: curpos=%r, color=%r' % (self._curpos, self._color)
#print ' refline:', self._get_refline(self._curpos+1)
@@ -487,7 +487,7 @@ def _do_pass(self):
self._curline[x] = self._color
self._curpos = x1
return
-
+
def _do_horizontal(self, n1, n2):
#print '* horizontal(%d,%d): curpos=%r, color=%r' % (n1, n2, self._curpos, self._color)
if self._curpos < 0:
@@ -503,7 +503,7 @@ def _do_horizontal(self, n1, n2):
x += 1
self._curpos = x
return
-
+
def _do_uncompressed(self, bits):
#print '* uncompressed(%r): curpos=%r' % (bits, self._curpos)
for c in bits:
@@ -672,16 +672,16 @@ def test_m3(self):
## CCITTFaxDecoder
##
class CCITTFaxDecoder(CCITTG4Parser):
-
+
def __init__(self, width, bytealign=False, reversed=False):
CCITTG4Parser.__init__(self, width, bytealign=bytealign)
self.reversed = reversed
self._buf = ''
return
-
+
def close(self):
return self._buf
-
+
def output_line(self, y, bits):
bytes = array.array('B', [0]*((len(bits)+7)/8))
if self.reversed:
@@ -704,8 +704,8 @@ def ccittfaxdecode(data, params):
raise ValueError(K)
parser.feedbytes(data)
return parser.close()
-
-
+
+
# test
def main(argv):
import pygame
View
@@ -81,7 +81,7 @@ def dump(self, out=sys.stdout, code2cid=None, code=None):
else:
self.dump(out=out, code2cid=v, code=c)
return
-
+
## IdentityCMap
##
@@ -100,8 +100,8 @@ def decode(self, code):
return struct.unpack('>%dH' % n, code)
else:
return ()
-
-
+
+
## UnicodeMap
##
@@ -162,7 +162,7 @@ def add_code2cid(self, code, cid):
## FileUnicodeMap
##
class FileUnicodeMap(UnicodeMap):
-
+
def __init__(self):
UnicodeMap.__init__(self)
self.attrs = {}
@@ -205,12 +205,12 @@ def __repr__(self):
def is_vertical(self):
return self._is_vertical
-
+
## PyUnicodeMap
##
class PyUnicodeMap(UnicodeMap):
-
+
def __init__(self, name, module, vertical):
if vertical:
cid2unichr = module.CID2UNICHR_V
@@ -231,7 +231,7 @@ class CMapDB(object):
debug = 0
_cmap_cache = {}
_umap_cache = {}
-
+
class CMapNotFound(CMapError): pass
@classmethod
View
@@ -119,7 +119,7 @@ def __init__(self, rsrcmgr, pageno=1, laparams=None):
PDFLayoutAnalyzer.__init__(self, rsrcmgr, pageno=pageno, laparams=laparams)
self.result = None
return
-
+
def receive_layout(self, ltpage):
self.result = ltpage
return
@@ -137,7 +137,7 @@ def __init__(self, rsrcmgr, outfp, codec='utf-8', pageno=1, laparams=None):
self.outfp = outfp
self.codec = codec
return
-
+
## TextConverter
##
@@ -179,7 +179,7 @@ def render_image(self, name, stream):
if self.imagewriter is None: return
PDFConverter.render_image(self, name, stream)
return
-
+
def paint_path(self, gstate, stroke, fill, evenodd, path):
return
@@ -197,13 +197,13 @@ class HTMLConverter(PDFConverter):
'curve': 'black',
'page': 'gray',
}
-
+
TEXT_COLORS = {
'textbox': 'blue',
'char': 'black',
}
- def __init__(self, rsrcmgr, outfp, codec='utf-8', pageno=1, laparams=None,
+ def __init__(self, rsrcmgr, outfp, codec='utf-8', pageno=1, laparams=None,
scale=1, fontscale=1.0, layoutmode='normal', showpageno=True,
pagemargin=50, imagewriter=None,
rect_colors={'curve':'black', 'page':'gray'},
@@ -295,7 +295,7 @@ def end_div(self, color):
self._font = self._fontstack.pop()
self.write('</div>')
return
-
+
def put_text(self, text, fontname, fontsize):
font = (fontname, fontsize)
if font != self._font:
@@ -399,7 +399,7 @@ def write_header(self):
def write_footer(self):
self.outfp.write('</pages>\n')
return
-
+
def write_text(self, text):
self.outfp.write(enc(text, self.codec))
return
View
@@ -8,7 +8,7 @@
The following data were extracted from the AFM files:
http://www.ctan.org/tex-archive/fonts/adobe/afm/
-
+
"""
### BEGIN Verbatim copy of the license part
View
@@ -70,7 +70,7 @@ def export_image(self, image):
(width, height) = image.srcsize
if len(filters) == 1 and filters[0] in LITERALS_DCT_DECODE:
ext = '.jpg'
- elif (image.bits == 1 or
+ elif (image.bits == 1 or
image.bits == 8 and image.colorspace in (LITERAL_DEVICE_RGB, LITERAL_DEVICE_GRAY)):
ext = '.%dx%d.bmp' % (width, height)
else:
@@ -84,7 +84,7 @@ def export_image(self, image):
from PIL import Image
from PIL import ImageChops
ifp = cStringIO.StringIO(raw_data)
- i = Image.open(ifp)
+ i = Image.open(ifp)
i = ImageChops.invert(i)
i = i.convert('RGB')
i.save(fp, 'JPEG')
Oops, something went wrong.

0 comments on commit c1da8b8

Please sign in to comment.