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

Skip to content

Commit e6ef481

Browse files
authored
Merge pull request #8728 from jhelie/fix-some-lgtm-alerts
MNT: fix some lgtm alerts
2 parents 3f99cd0 + f991769 commit e6ef481

File tree

10 files changed

+8
-23
lines changed

10 files changed

+8
-23
lines changed

examples/pylab_examples/arrow_demo.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ def do_fontsize(k):
119119

120120
arrow_h_offset = 0.25 # data coordinates, empirically determined
121121
max_arrow_length = 1 - 2*arrow_h_offset
122-
123-
max_arrow_width = max_arrow_width
124122
max_head_width = 2.5*max_arrow_width
125123
max_head_length = 2*max_arrow_width
126124
arrow_params = {'length_includes_head': True, 'shape': shape,
@@ -165,10 +163,9 @@ def draw_arrow(pair, alpha=alpha, ec=ec, labelcolor=labelcolor):
165163
else:
166164
length = max_arrow_length
167165
# set the transparency of the arrow
168-
if display == 'alph':
166+
if display == 'alpha':
169167
alpha = min(data[pair]/sf, alpha)
170-
else:
171-
alpha = alpha
168+
172169
# set the width of the arrow
173170
if display == 'width':
174171
scale = data[pair]/sf

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ def _get_papertype(w, h):
137137
if key.startswith('l'): continue
138138
pw, ph = papersize[key]
139139
if (w < pw) and (h < ph): return key
140-
else:
141-
return 'a0'
140+
return 'a0'
142141

143142
def _num_to_str(val):
144143
if isinstance(val, six.string_types): return val

lib/matplotlib/backends/qt_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ def _getSaveFileName(*args, **kwargs):
190190
_getSaveFileName = QtWidgets.QFileDialog.getSaveFileName
191191
except ImportError:
192192
# tried PySide2, failed, fall back to PySide
193-
QT_API = rcParams['backend.qt4']
194193
QT_RC_MAJOR_VERSION = 4
195194
QT_API = QT_API_PYSIDE
196195

lib/matplotlib/figure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,6 @@ def set_size_inches(self, w, h=None, forward=True):
717717
if not all(np.isfinite(_) for _ in (w, h)):
718718
raise ValueError('figure size must be finite not '
719719
'({}, {})'.format(w, h))
720-
dpival = self.dpi
721720
self.bbox_inches.p1 = w, h
722721

723722
if forward:

lib/matplotlib/mlab.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3881,7 +3881,6 @@ def cross_from_below(x, threshold):
38813881
38823882
"""
38833883
x = np.asarray(x)
3884-
threshold = threshold
38853884
ind = np.nonzero((x[:-1] < threshold) & (x[1:] >= threshold))[0]
38863885
if len(ind):
38873886
return ind+1

lib/matplotlib/rcsetup.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,9 +1216,6 @@ def _validate_linestyle(ls):
12161216
'legend.borderaxespad': [0.5, validate_float],
12171217
# the border between the axes and legend edge
12181218
'legend.columnspacing': [2., validate_float],
1219-
# the relative size of legend markers vs. original
1220-
'legend.markerscale': [1.0, validate_float],
1221-
'legend.shadow': [False, validate_bool],
12221219
'legend.facecolor': ['inherit', validate_color_or_inherit],
12231220
'legend.edgecolor': ['0.8', validate_color_or_inherit],
12241221

lib/matplotlib/stackplot.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def stackplot(axes, x, *args, **kwargs):
8686

8787
elif baseline == 'weighted_wiggle':
8888
m, n = y.shape
89-
center = np.zeros(n)
9089
total = np.sum(y, 0)
9190
# multiply by 1/total (or zero) to avoid infinities in the division:
9291
inv_total = np.zeros_like(total)

lib/matplotlib/transforms.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,12 +1305,9 @@ def transform(self, values):
13051305
return res.reshape(-1)
13061306
elif ndim == 2:
13071307
return res
1308-
else:
1309-
raise ValueError(
1310-
"Input values must have shape (N x {dims}) "
1311-
"or ({dims}).".format(dims=self.input_dims))
1312-
1313-
return res
1308+
raise ValueError(
1309+
"Input values must have shape (N x {dims}) "
1310+
"or ({dims}).".format(dims=self.input_dims))
13141311

13151312
def transform_affine(self, values):
13161313
"""

lib/mpl_toolkits/axisartist/clip_path.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import warnings
1111

1212
def atan2(dy, dx):
13-
if dx == 0 and dx == 0:
13+
if dx == 0 and dy == 0:
1414
warnings.warn("dx and dy is 0")
1515
return 0
1616
else:

tools/gh_api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ def get_milestone_id(project, milestone, auth=False, **params):
183183
for mstone in milestones:
184184
if mstone['title'] == milestone:
185185
return mstone['number']
186-
else:
187-
raise ValueError("milestone %s not found" % milestone)
186+
raise ValueError("milestone %s not found" % milestone)
188187

189188
def is_pull_request(issue):
190189
"""Return True if the given issue is a pull request."""

0 commit comments

Comments
 (0)