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

Skip to content

Commit 2e95ec4

Browse files
authored
Merge pull request #12829 from timhoffm/remove-unused-variable
Remove unused variables
2 parents c167c62 + 94ea287 commit 2e95ec4

File tree

15 files changed

+25
-58
lines changed

15 files changed

+25
-58
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def __setitem__(self, key, val):
822822
"either import that binding first, or set the QT_API "
823823
"environment variable.")
824824
cbook.warn_deprecated(
825-
"2.2", name=key, obj_type="rcparam", addendum=addendum)
825+
version, name=key, obj_type="rcparam", addendum=addendum)
826826
elif key in _deprecated_ignore_map:
827827
version, alt_key = _deprecated_ignore_map[key]
828828
cbook.warn_deprecated(

lib/matplotlib/_layoutbox.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,6 @@ def plot_children(fig, box, level=0, printit=True):
707707
if printit:
708708
print("Level:", level)
709709
for child in box.children:
710-
rect = child.get_rect()
711710
if printit:
712711
print(child)
713712
ax.add_patch(

lib/matplotlib/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def get_versions():
436436
# versionfile_source is the relative path from the top of the source
437437
# tree (where the .git directory might live) to this file. Invert
438438
# this to find the root from __file__.
439-
for i in cfg.versionfile_source.split('/'):
439+
for _ in cfg.versionfile_source.split('/'):
440440
root = os.path.dirname(root)
441441
except NameError:
442442
return {"version": "0+unknown", "full-revisionid": None,

lib/matplotlib/artist.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,7 +1393,6 @@ def pprint_setters_rest(self, prop=None, leadingspace=4):
13931393
return '%s%s: %s' % (pad, prop, accepts)
13941394

13951395
attrs = sorted(self._get_setters_and_targets())
1396-
lines = []
13971396

13981397
names = [self.aliased_name_rest(prop, target)
13991398
for prop, target in attrs]

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ def get_text_width_height_descent(self, s, prop, ismath):
613613
"""
614614
if ismath == 'TeX':
615615
# todo: handle props
616-
size = prop.get_size_in_points()
617616
texmanager = self._text2path.get_texmanager()
618617
fontsize = prop.get_size_in_points()
619618
w, h, d = texmanager.get_text_width_height_descent(

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ def init_window(self):
971971

972972
canvas = type(self.canvas)(toolfig, master=self.window)
973973
toolfig.subplots_adjust(top=0.9)
974-
_tool = SubplotTool(self.figure, toolfig)
974+
SubplotTool(self.figure, toolfig)
975975
canvas.draw()
976976
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
977977
self.window.protocol("WM_DELETE_WINDOW", self.destroy)

lib/matplotlib/backends/backend_agg.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ def get_text_width_height_descent(self, s, prop, ismath):
196196

197197
if ismath in ["TeX", "TeX!"]:
198198
# todo: handle props
199-
size = prop.get_size_in_points()
200199
texmanager = self.get_texmanager()
201200
fontsize = prop.get_size_in_points()
202201
w, h, d = texmanager.get_text_width_height_descent(
@@ -389,7 +388,6 @@ def draw(self):
389388
# acquire a lock on the shared font cache
390389
RendererAgg.lock.acquire()
391390

392-
toolbar = self.toolbar
393391
try:
394392
self.figure.draw(self.renderer)
395393
# A GUI class may be need to update a window using this draw, so

lib/matplotlib/backends/backend_gtk3cairo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _render_figure(self, width, height):
2121

2222
def on_draw_event(self, widget, ctx):
2323
"""GtkDrawable draw event."""
24-
toolbar = self.toolbar
24+
# toolbar = self.toolbar
2525
# if toolbar:
2626
# toolbar.set_cursor(cursors.WAIT)
2727
self._renderer.set_context(ctx)

lib/matplotlib/backends/backend_wx.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,7 +1138,6 @@ def __init__(self, num, fig):
11381138
pos = wx.DefaultPosition
11391139
else:
11401140
pos = wx.Point(20, 20)
1141-
l, b, w, h = fig.bbox.bounds
11421141
wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
11431142
title="Figure %d" % num)
11441143
# Frame will be sized later by the Fit method
@@ -1471,15 +1470,15 @@ def __init__(self, targetfig):
14711470
canvas = FigureCanvasWx(self, -1, toolfig)
14721471

14731472
# Create a figure manager to manage things
1474-
figmgr = FigureManager(canvas, 1, self)
1473+
FigureManager(canvas, 1, self)
14751474

14761475
# Now put all into a sizer
14771476
sizer = wx.BoxSizer(wx.VERTICAL)
14781477
# This way of adding to sizer allows resizing
14791478
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
14801479
self.SetSizer(sizer)
14811480
self.Fit()
1482-
tool = SubplotTool(targetfig, toolfig)
1481+
SubplotTool(targetfig, toolfig)
14831482

14841483

14851484
class NavigationToolbar2Wx(NavigationToolbar2, wx.ToolBar):
@@ -1540,15 +1539,15 @@ def configure_subplots(self, evt):
15401539
canvas = self.get_canvas(frame, toolfig)
15411540

15421541
# Create a figure manager to manage things
1543-
figmgr = FigureManager(canvas, 1, frame)
1542+
FigureManager(canvas, 1, frame)
15441543

15451544
# Now put all into a sizer
15461545
sizer = wx.BoxSizer(wx.VERTICAL)
15471546
# This way of adding to sizer allows resizing
15481547
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
15491548
frame.SetSizer(sizer)
15501549
frame.Fit()
1551-
tool = SubplotTool(self.canvas.figure, toolfig)
1550+
SubplotTool(self.canvas.figure, toolfig)
15521551
frame.Show()
15531552

15541553
def save_figure(self, *args):
@@ -1804,7 +1803,7 @@ def configure_subplots(self):
18041803
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
18051804
frame.SetSizer(sizer)
18061805
frame.Fit()
1807-
tool = SubplotTool(self.canvas.figure, toolfig)
1806+
SubplotTool(self.canvas.figure, toolfig)
18081807
frame.Show()
18091808

18101809
def get_canvas(self, frame, fig):

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ def bubble(self, o):
706706
bubbles.append(thiso)
707707
else:
708708
self.push(thiso)
709-
for thiso in bubbles:
709+
for _ in bubbles:
710710
self.push(o)
711711
return o
712712

lib/matplotlib/offsetbox.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,15 +806,12 @@ def get_window_extent(self, renderer):
806806
return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)
807807

808808
def get_extent(self, renderer):
809-
clean_line, ismath = self._text.is_math_text(self._text._text)
810809
_, h_, d_ = renderer.get_text_width_height_descent(
811810
"lp", self._text._fontproperties, ismath=False)
812811

813812
bbox, info, d = self._text._get_layout(renderer)
814813
w, h = bbox.width, bbox.height
815814

816-
line = info[-1][0] # last line
817-
818815
self._baseline_transform.clear()
819816

820817
if len(info) > 1 and self._multilinebaseline:
@@ -1544,8 +1541,6 @@ def _update_position_xybox(self, renderer, xy_pixel):
15441541
ox1, oy1 = x, y
15451542

15461543
if self.arrowprops:
1547-
x0, y0 = x, y
1548-
15491544
d = self.arrowprops.copy()
15501545

15511546
# Use FancyArrowPatch if self.arrowprops has "arrowstyle" key.

lib/matplotlib/patches.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,30 +3324,26 @@ def transmute(self, path, mutation_size, linewidth):
33243324
x1, y1 = path.vertices[1]
33253325

33263326
# If there is no room for an arrow and a line, then skip the arrow
3327-
has_begin_arrow = self.beginarrow and not (x0 == x1 and y0 == y1)
3328-
if has_begin_arrow:
3329-
verticesA, codesA, ddxA, ddyA = \
3330-
self._get_arrow_wedge(x1, y1, x0, y0,
3331-
head_dist, cos_t, sin_t,
3332-
linewidth)
3333-
else:
3334-
verticesA, codesA = [], []
3335-
ddxA, ddyA = 0., 0.
3327+
has_begin_arrow = self.beginarrow and (x0, y0) != (x1, y1)
3328+
verticesA, codesA, ddxA, ddyA = (
3329+
self._get_arrow_wedge(x1, y1, x0, y0,
3330+
head_dist, cos_t, sin_t, linewidth)
3331+
if has_begin_arrow
3332+
else ([], [], 0, 0)
3333+
)
33363334

33373335
# end arrow
33383336
x2, y2 = path.vertices[-2]
33393337
x3, y3 = path.vertices[-1]
33403338

33413339
# If there is no room for an arrow and a line, then skip the arrow
3342-
has_end_arrow = (self.endarrow and not (x2 == x3 and y2 == y3))
3343-
if has_end_arrow:
3344-
verticesB, codesB, ddxB, ddyB = \
3345-
self._get_arrow_wedge(x2, y2, x3, y3,
3346-
head_dist, cos_t, sin_t,
3347-
linewidth)
3348-
else:
3349-
verticesB, codesB = [], []
3350-
ddxB, ddyB = 0., 0.
3340+
has_end_arrow = self.endarrow and (x2, y2) != (x3, y3)
3341+
verticesB, codesB, ddxB, ddyB = (
3342+
self._get_arrow_wedge(x2, y2, x3, y3,
3343+
head_dist, cos_t, sin_t, linewidth)
3344+
if has_end_arrow
3345+
else ([], [], 0, 0)
3346+
)
33513347

33523348
# This simple code will not work if ddx, ddy is greater than the
33533349
# separation between vertices.

lib/matplotlib/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def _update_clip_properties(self):
538538
clip_path=self._clippath,
539539
clip_on=self._clipon)
540540
if self._bbox_patch:
541-
bbox = self._bbox_patch.update(clipprops)
541+
self._bbox_patch.update(clipprops)
542542

543543
def set_clip_box(self, clipbox):
544544
# docstring inherited.

lib/matplotlib/widgets.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,15 +1134,6 @@ def __init__(self, targetfig, toolfig):
11341134
self.targetfig = targetfig
11351135
toolfig.subplots_adjust(left=0.2, right=0.9)
11361136

1137-
class toolbarfmt:
1138-
def __init__(self, slider):
1139-
self.slider = slider
1140-
1141-
def __call__(self, x, y):
1142-
fmt = '%s=%s' % (self.slider.label.get_text(),
1143-
self.slider.valfmt)
1144-
return fmt % x
1145-
11461137
self.axleft = toolfig.add_subplot(711)
11471138
self.axleft.set_title('Click on slider to adjust subplot param')
11481139
self.axleft.set_navigate(False)

lib/mpl_toolkits/axisartist/axislines.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,6 @@ def get_axislabel_pos_angle(self, axes):
284284
285285
get_label_transform() returns a transform of (transAxes+offset)
286286
"""
287-
loc = self._axis_direction
288-
#angle = dict(left=0,
289-
# right=0,
290-
# bottom=.5*np.pi,
291-
# top=.5*np.pi)[loc]
292-
293287
if self.nth_coord == 0:
294288
angle = 0
295289
else:
@@ -450,9 +444,6 @@ def new_floating_axis(self, nth_coord, value,
450444
"'new_floating_axis' explicitly requires the axes keyword.")
451445
axes = self.axes
452446

453-
passthrough_point = (value, value)
454-
transform = axes.transData
455-
456447
_helper = AxisArtistHelperRectlinear.Floating(
457448
axes, nth_coord, value, axis_direction)
458449

0 commit comments

Comments
 (0)