Skip to content

Various pep8 fixes - specifically targeting files which are failing travis pep8 tests #4155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 28, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
STY: More travis pep8 fixes
  • Loading branch information
cimarronm committed Feb 26, 2015
commit a0476c9f8f46f80146d60b98524c170a27614adc
29 changes: 13 additions & 16 deletions lib/matplotlib/backends/backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ def __init__(self, filename):
self.fontNames = {} # maps filenames to internal font names
self.nextFont = 1 # next free internal font name
self.dviFontInfo = {} # information on dvi fonts
self.type1Descriptors = {} # differently encoded Type-1 fonts may
# share the same descriptor
# differently encoded Type-1 fonts may share the same descriptor
self.type1Descriptors = {}
self.used_characters = {}

self.alphaStates = {} # maps alpha values to graphics state objects
Expand All @@ -480,8 +480,7 @@ def __init__(self, filename):

self.paths = []

self.pageAnnotations = [] # A list of annotations for the
# current page
self.pageAnnotations = [] # A list of annotations for the current page

# The PDF spec recommends to include every procset
procsets = [Name(x)
Expand Down Expand Up @@ -769,7 +768,7 @@ def createType1Descriptor(self, t1font, fontfile):
'FontFamily': t1font.prop['FamilyName'],
'StemV': 50, # TODO
# (see also revision 3874; but not all TeX distros have AFM files!)
#'FontWeight': a number where 400 = Regular, 700 = Bold
# 'FontWeight': a number where 400 = Regular, 700 = Bold
}

self.writeObject(fontdescObject, descriptor)
Expand Down Expand Up @@ -1251,8 +1250,8 @@ def imageObject(self, image):
self.images[image] = (name, ob)
return name

## These two from backend_ps.py
## TODO: alpha (SMask, p. 518 of pdf spec)
# These two from backend_ps.py
# TODO: alpha (SMask, p. 518 of pdf spec)

def _rgb(self, im):
h, w, s = im.as_rgba_str()
Expand Down Expand Up @@ -1710,10 +1709,8 @@ def draw_markers(self, gc, marker_path, marker_trans, path, trans,
simplify=False):
if len(vertices):
x, y = vertices[-2:]
if (x < 0 or
y < 0 or
x > self.file.width * 72 or
y > self.file.height * 72):
if (x < 0 or y < 0 or
x > self.file.width * 72 or y > self.file.height * 72):
continue
dx, dy = x - lastx, y - lasty
output(1, 0, 0, 1, dx, dy, Op.concat_matrix,
Expand Down Expand Up @@ -1970,8 +1967,8 @@ def check_simple_method(s):
chunks[-1][1].append(c)
else:
chunks.append((char_type, [c]))
use_simple_method = (len(chunks) == 1
and chunks[-1][0] == 1)
use_simple_method = (len(chunks) == 1 and
chunks[-1][0] == 1)
return use_simple_method, chunks

def draw_text_simple():
Expand Down Expand Up @@ -2255,7 +2252,7 @@ def clip_cmd(self, cliprect, clippath):
cmds.extend(self.pop())
# Unless we hit the right one, set the clip polygon
if ((self._cliprect, self._clippath) != (cliprect, clippath) or
self.parent is None):
self.parent is None):
cmds.extend(self.push())
if self._cliprect != cliprect:
cmds.extend([cliprect, Op.rectangle, Op.clip, Op.endpath])
Expand Down Expand Up @@ -2417,8 +2414,8 @@ def close(self):
PDF file.
"""
self._file.close()
if (self.get_pagecount() == 0 and not self.keep_empty
and not self._file.passed_in_file_object):
if (self.get_pagecount() == 0 and not self.keep_empty and
not self._file.passed_in_file_object):
os.remove(self._file.fh.name)
self._file = None

Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def recursive_pickle(top_obj):
objs = sorted(six.itervalues(objs), key=lambda val: (-val[0], val[2]))

for _, obj, location in objs:
# print('trying %s' % location)
try:
pickle.dump(obj, BytesIO(), pickle.HIGHEST_PROTOCOL)
except Exception as err:
Expand Down