Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfed541

Browse files
committed
STY: Reversed E113 pep errors where the indenting of comments looked fine. Also addressed comments from @efiring
1 parent a0476c9 commit dfed541

9 files changed

Lines changed: 43 additions & 49 deletions

File tree

examples/pylab_examples/multipage_pdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
x = np.arange(0, 5, 0.1)
2424
plt.plot(x, np.sin(x), 'b-')
2525
plt.title('Page Two')
26-
# you can add a pdf note to attach metadata to a page
27-
pdf.attach_note("plot of sin(x)")
26+
pdf.attach_note("plot of sin(x)") # you can add a pdf note to
27+
# attach metadata to a page
2828
pdf.savefig()
2929
plt.close()
3030

examples/pylab_examples/tricontour_smooth_delaunay.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,18 @@ def experiment_res(x, y):
4545
# User parameters for data test points
4646
n_test = 200 # Number of test data points, tested from 3 to 5000 for subdiv=3
4747

48-
# Number of recursive subdivisions of the initial mesh for smooth plots.
49-
# Values >3 might result in a very high number of triangles for the refine
50-
# mesh: new triangles numbering = (4**subdiv)*ntri
51-
subdiv = 3
52-
53-
# Float > 0. adjusting the proportion of (invalid) initial triangles which will
54-
# be masked out. Enter 0 for no mask.
55-
init_mask_frac = 0.0
56-
57-
# Minimum circle ratio - border triangles with circle ratio below this will
58-
# be masked if they touch a border. Suggested value 0.01; Use -1 to keep
59-
# all triangles.
60-
min_circle_ratio = .01
48+
subdiv = 3 # Number of recursive subdivisions of the initial mesh for smooth
49+
# plots. Values >3 might result in a very high number of triangles
50+
# for the refine mesh: new triangles numbering = (4**subdiv)*ntri
51+
52+
init_mask_frac = 0.0 # Float > 0. adjusting the proportion of
53+
# (invalid) initial triangles which will be masked
54+
# out. Enter 0 for no mask.
55+
56+
min_circle_ratio = .01 # Minimum circle ratio - border triangles with circle
57+
# ratio below this will be masked if they touch a
58+
# border. Suggested value 0.01 ; Use -1 to keep
59+
# all triangles.
6160

6261
# Random points
6362
random_gen = np.random.mtrand.RandomState(seed=127260)

examples/user_interfaces/embedding_in_tk.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ def on_key_event(event):
4848

4949
def _quit():
5050
root.quit() # stops mainloop
51-
# this is necessary on Windows to prevent
52-
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
53-
root.destroy()
51+
root.destroy() # this is necessary on Windows to prevent
52+
# Fatal Python Error: PyEval_RestoreThread: NULL tstate
5453

5554
button = Tk.Button(master=root, text='Quit', command=_quit)
5655
button.pack(side=Tk.BOTTOM)

lib/matplotlib/backends/backend_pdf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,8 @@ def __init__(self, filename):
462462
self.fontNames = {} # maps filenames to internal font names
463463
self.nextFont = 1 # next free internal font name
464464
self.dviFontInfo = {} # information on dvi fonts
465-
# differently encoded Type-1 fonts may share the same descriptor
466-
self.type1Descriptors = {}
465+
self.type1Descriptors = {} # differently encoded Type-1 fonts may
466+
# share the same descriptor
467467
self.used_characters = {}
468468

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

481481
self.paths = []
482482

483-
self.pageAnnotations = [] # A list of annotations for the current page
483+
self.pageAnnotations = [] # A list of annotations for the
484+
# current page
484485

485486
# The PDF spec recommends to include every procset
486487
procsets = [Name(x)

lib/matplotlib/colors.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ def makeMappingArray(N, data, gamma=1.0):
482482
lut[-1] = y0[-1]
483483
# ensure that the lut is confined to values between 0 and 1 by clipping it
484484
np.clip(lut, 0.0, 1.0)
485-
# lut = where(lut > 1., 1., lut)
486-
# lut = where(lut < 0., 0., lut)
487485
return lut
488486

489487

@@ -614,9 +612,6 @@ def __call__(self, X, alpha=None, bytes=False):
614612

615613
rgba = np.empty(shape=xa.shape + (4,), dtype=lut.dtype)
616614
lut.take(xa, axis=0, mode='clip', out=rgba)
617-
# twice as fast as lut[xa];
618-
# using the clip or wrap mode and providing an
619-
# output array speeds it up a little more.
620615
if vtype == 'scalar':
621616
rgba = tuple(rgba[0, :])
622617
return rgba
@@ -810,8 +805,8 @@ def __init__(self, colors, name='from_list', N=None):
810805
the list will be extended by repetition.
811806
"""
812807
self.colors = colors
813-
# True only if all colors in map are identical; needed for contouring.
814-
self.monochrome = False
808+
self.monochrome = False # True only if all colors in map are
809+
# identical; needed for contouring.
815810
if N is None:
816811
N = len(self.colors)
817812
else:
@@ -1384,7 +1379,6 @@ def hsv_to_rgb(hsv):
13841379
rgb : (..., 3) ndarray
13851380
Colors converted to RGB values in range [0, 1]
13861381
"""
1387-
# make sure it is an ndarray
13881382
hsv = np.asarray(hsv)
13891383

13901384
# check length of the last dimension, should be _some_ sort of rgb

lib/matplotlib/contour.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,8 @@ def __init__(self, ax, *args, **kwargs):
838838
self.extend = kwargs.get('extend', 'neither')
839839
self.antialiased = kwargs.get('antialiased', None)
840840
if self.antialiased is None and self.filled:
841-
# eliminate artifacts; we are not stroking the boundaries
842-
self.antialiased = False
841+
self.antialiased = False # eliminate artifacts; we are not
842+
# stroking the boundaries.
843843
# The default for line contours will be taken from
844844
# the LineCollection default, which uses the
845845
# rcParams['lines.antialiased']

lib/matplotlib/image.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,9 @@ def _draw_unsampled_image(self, renderer, gc):
331331

332332
if numrows <= 0 or numcols <= 0:
333333
return
334-
335-
# just to create im.bufOut that is required by backends. There may be
336-
# a better solution -JJL
337-
im.resize(numcols, numrows)
334+
im.resize(numcols, numrows) # just to create im.bufOut that
335+
# is required by backends. There
336+
# may be better solution -JJL
338337

339338
im._url = self.get_url()
340339
im._gid = self.get_gid()

lib/matplotlib/quiver.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,10 @@ def on_dpi_change(fig):
249249
self_weakref = weak_self()
250250
if self_weakref is not None:
251251
self_weakref.labelsep = (self_weakref._labelsep_inches*fig.dpi)
252-
# simple brute force update works because _init is called at
253-
# the start of draw
254-
self_weakref._initialized = False
252+
self_weakref._initialized = False # simple brute force update
253+
# works because _init is
254+
# called at the start of
255+
# draw.
255256

256257
self._cid = Q.ax.figure.callbacks.connect('dpi_changed',
257258
on_dpi_change)
@@ -467,11 +468,12 @@ def __init__(self, ax, *args, **kw):
467468
def on_dpi_change(fig):
468469
self_weakref = weak_self()
469470
if self_weakref is not None:
470-
# vertices depend on width, span which in turn depend on dpi
471-
self_weakref._new_UV = True
472-
# simple brute force update works because _init is called at
473-
# the start of draw
474-
self_weakref._initialized = False
471+
self_weakref._new_UV = True # vertices depend on width, span
472+
# which in turn depend on dpi
473+
self_weakref._initialized = False # simple brute force update
474+
# works because _init is
475+
# called at the start of
476+
# draw.
475477

476478
self._cid = self.ax.figure.callbacks.connect('dpi_changed',
477479
on_dpi_change)
@@ -698,9 +700,9 @@ def _h_arrows(self, length):
698700
if self.pivot == 'middle':
699701
X -= 0.5 * X[:, 3, np.newaxis]
700702
elif self.pivot == 'tip':
701-
# numpy bug? using -= does not work here unless we multiply by a
702-
# float first, as with 'mid'.
703-
X = X - X[:, 3, np.newaxis]
703+
X = X - X[:, 3, np.newaxis] # numpy bug? using -= does not
704+
# work here unless we multiply
705+
# by a float first, as with 'mid'.
704706
tooshort = length < self.minlength
705707
if tooshort.any():
706708
# Use a heptagonal dot:

lib/matplotlib/tight_layout.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ def get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer,
296296
ncols_list = []
297297
ax_bbox_list = []
298298

299-
# multiple axes can share same subplot_interface (e.g., axes_grid1). Thus
300-
# we need to join them together.
301-
subplot_dict = {}
299+
subplot_dict = {} # multiple axes can share
300+
# same subplot_interface (e.g., axes_grid1). Thus
301+
# we need to join them together.
302302

303303
subplotspec_list2 = []
304304

0 commit comments

Comments
 (0)