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

Skip to content

Remove unused variables #12829

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 1 commit into from
Nov 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion lib/matplotlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def __setitem__(self, key, val):
"either import that binding first, or set the QT_API "
"environment variable.")
cbook.warn_deprecated(
"2.2", name=key, obj_type="rcparam", addendum=addendum)
version, name=key, obj_type="rcparam", addendum=addendum)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the hard-coded value.

elif key in _deprecated_ignore_map:
version, alt_key = _deprecated_ignore_map[key]
cbook.warn_deprecated(
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/_layoutbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,6 @@ def plot_children(fig, box, level=0, printit=True):
if printit:
print("Level:", level)
for child in box.children:
rect = child.get_rect()
if printit:
print(child)
ax.add_patch(
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def get_versions():
# versionfile_source is the relative path from the top of the source
# tree (where the .git directory might live) to this file. Invert
# this to find the root from __file__.
for i in cfg.versionfile_source.split('/'):
for _ in cfg.versionfile_source.split('/'):
root = os.path.dirname(root)
except NameError:
return {"version": "0+unknown", "full-revisionid": None,
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,6 @@ def pprint_setters_rest(self, prop=None, leadingspace=4):
return '%s%s: %s' % (pad, prop, accepts)

attrs = sorted(self._get_setters_and_targets())
lines = []

names = [self.aliased_name_rest(prop, target)
for prop, target in attrs]
Expand Down
1 change: 0 additions & 1 deletion lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ def get_text_width_height_descent(self, s, prop, ismath):
"""
if ismath == 'TeX':
# todo: handle props
size = prop.get_size_in_points()
texmanager = self._text2path.get_texmanager()
fontsize = prop.get_size_in_points()
w, h, d = texmanager.get_text_width_height_descent(
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/_backend_tk.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ def init_window(self):

canvas = type(self.canvas)(toolfig, master=self.window)
toolfig.subplots_adjust(top=0.9)
_tool = SubplotTool(self.figure, toolfig)
SubplotTool(self.figure, toolfig)
canvas.draw()
canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=1)
self.window.protocol("WM_DELETE_WINDOW", self.destroy)
Expand Down
2 changes: 0 additions & 2 deletions lib/matplotlib/backends/backend_agg.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ def get_text_width_height_descent(self, s, prop, ismath):

if ismath in ["TeX", "TeX!"]:
# todo: handle props
size = prop.get_size_in_points()
texmanager = self.get_texmanager()
fontsize = prop.get_size_in_points()
w, h, d = texmanager.get_text_width_height_descent(
Expand Down Expand Up @@ -389,7 +388,6 @@ def draw(self):
# acquire a lock on the shared font cache
RendererAgg.lock.acquire()

toolbar = self.toolbar
try:
self.figure.draw(self.renderer)
# A GUI class may be need to update a window using this draw, so
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/backends/backend_gtk3cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def _render_figure(self, width, height):

def on_draw_event(self, widget, ctx):
"""GtkDrawable draw event."""
toolbar = self.toolbar
# toolbar = self.toolbar
# if toolbar:
# toolbar.set_cursor(cursors.WAIT)
self._renderer.set_context(ctx)
Expand Down
11 changes: 5 additions & 6 deletions lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,6 @@ def __init__(self, num, fig):
pos = wx.DefaultPosition
else:
pos = wx.Point(20, 20)
l, b, w, h = fig.bbox.bounds
wx.Frame.__init__(self, parent=None, id=-1, pos=pos,
title="Figure %d" % num)
# Frame will be sized later by the Fit method
Expand Down Expand Up @@ -1471,15 +1470,15 @@ def __init__(self, targetfig):
canvas = FigureCanvasWx(self, -1, toolfig)

# Create a figure manager to manage things
figmgr = FigureManager(canvas, 1, self)
FigureManager(canvas, 1, self)

# Now put all into a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
self.SetSizer(sizer)
self.Fit()
tool = SubplotTool(targetfig, toolfig)
SubplotTool(targetfig, toolfig)


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

# Create a figure manager to manage things
figmgr = FigureManager(canvas, 1, frame)
FigureManager(canvas, 1, frame)

# Now put all into a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
frame.SetSizer(sizer)
frame.Fit()
tool = SubplotTool(self.canvas.figure, toolfig)
SubplotTool(self.canvas.figure, toolfig)
frame.Show()

def save_figure(self, *args):
Expand Down Expand Up @@ -1804,7 +1803,7 @@ def configure_subplots(self):
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
frame.SetSizer(sizer)
frame.Fit()
tool = SubplotTool(self.canvas.figure, toolfig)
SubplotTool(self.canvas.figure, toolfig)
frame.Show()

def get_canvas(self, frame, fig):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/cbook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,7 @@ def bubble(self, o):
bubbles.append(thiso)
else:
self.push(thiso)
for thiso in bubbles:
for _ in bubbles:
self.push(o)
return o

Expand Down
5 changes: 0 additions & 5 deletions lib/matplotlib/offsetbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,15 +806,12 @@ def get_window_extent(self, renderer):
return mtransforms.Bbox.from_bounds(ox - xd, oy - yd, w, h)

def get_extent(self, renderer):
clean_line, ismath = self._text.is_math_text(self._text._text)
_, h_, d_ = renderer.get_text_width_height_descent(
"lp", self._text._fontproperties, ismath=False)

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

line = info[-1][0] # last line

self._baseline_transform.clear()

if len(info) > 1 and self._multilinebaseline:
Expand Down Expand Up @@ -1543,8 +1540,6 @@ def _update_position_xybox(self, renderer, xy_pixel):
ox1, oy1 = x, y

if self.arrowprops:
x0, y0 = x, y

d = self.arrowprops.copy()

# Use FancyArrowPatch if self.arrowprops has "arrowstyle" key.
Expand Down
32 changes: 14 additions & 18 deletions lib/matplotlib/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3325,30 +3325,26 @@ def transmute(self, path, mutation_size, linewidth):
x1, y1 = path.vertices[1]

# If there is no room for an arrow and a line, then skip the arrow
has_begin_arrow = self.beginarrow and not (x0 == x1 and y0 == y1)
if has_begin_arrow:
verticesA, codesA, ddxA, ddyA = \
self._get_arrow_wedge(x1, y1, x0, y0,
head_dist, cos_t, sin_t,
linewidth)
else:
verticesA, codesA = [], []
ddxA, ddyA = 0., 0.
has_begin_arrow = self.beginarrow and (x0, y0) != (x1, y1)
verticesA, codesA, ddxA, ddyA = (
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO this way it's more clear that the whole block is just a conditional assignment of the four variables.

self._get_arrow_wedge(x1, y1, x0, y0,
head_dist, cos_t, sin_t, linewidth)
if has_begin_arrow
else ([], [], 0, 0)
)

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

# If there is no room for an arrow and a line, then skip the arrow
has_end_arrow = (self.endarrow and not (x2 == x3 and y2 == y3))
if has_end_arrow:
verticesB, codesB, ddxB, ddyB = \
self._get_arrow_wedge(x2, y2, x3, y3,
head_dist, cos_t, sin_t,
linewidth)
else:
verticesB, codesB = [], []
ddxB, ddyB = 0., 0.
has_end_arrow = self.endarrow and (x2, y2) != (x3, y3)
verticesB, codesB, ddxB, ddyB = (
self._get_arrow_wedge(x2, y2, x3, y3,
head_dist, cos_t, sin_t, linewidth)
if has_end_arrow
else ([], [], 0, 0)
)

# This simple code will not work if ddx, ddy is greater than the
# separation between vertices.
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ def _update_clip_properties(self):
clip_path=self._clippath,
clip_on=self._clipon)
if self._bbox_patch:
bbox = self._bbox_patch.update(clipprops)
self._bbox_patch.update(clipprops)

def set_clip_box(self, clipbox):
# docstring inherited.
Expand Down
9 changes: 0 additions & 9 deletions lib/matplotlib/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1134,15 +1134,6 @@ def __init__(self, targetfig, toolfig):
self.targetfig = targetfig
toolfig.subplots_adjust(left=0.2, right=0.9)

class toolbarfmt:
def __init__(self, slider):
self.slider = slider

def __call__(self, x, y):
fmt = '%s=%s' % (self.slider.label.get_text(),
self.slider.valfmt)
return fmt % x

self.axleft = toolfig.add_subplot(711)
self.axleft.set_title('Click on slider to adjust subplot param')
self.axleft.set_navigate(False)
Expand Down
9 changes: 0 additions & 9 deletions lib/mpl_toolkits/axisartist/axislines.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,6 @@ def get_axislabel_pos_angle(self, axes):

get_label_transform() returns a transform of (transAxes+offset)
"""
loc = self._axis_direction
#angle = dict(left=0,
# right=0,
# bottom=.5*np.pi,
# top=.5*np.pi)[loc]

if self.nth_coord == 0:
angle = 0
else:
Expand Down Expand Up @@ -450,9 +444,6 @@ def new_floating_axis(self, nth_coord, value,
"'new_floating_axis' explicitly requires the axes keyword.")
axes = self.axes

passthrough_point = (value, value)
transform = axes.transData

_helper = AxisArtistHelperRectlinear.Floating(
axes, nth_coord, value, axis_direction)

Expand Down