From ef5248fe6305d1eb08700fdb5c8c3051bb1d5e72 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 12 Feb 2018 00:51:27 -0500 Subject: [PATCH 1/2] Fix print statements in docstrings and comments. --- lib/matplotlib/backends/backend_wx.py | 3 ++- lib/matplotlib/dviread.py | 2 +- tutorials/intermediate/artists.py | 22 +++++++++++----------- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index eca26613c93f..4f0e6638334b 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -62,7 +62,8 @@ def DEBUG_MSG(string, lvl=3, o=None): # Jeremy, often times the commented line won't print but the # one below does. I think WX is redefining stderr, damned # beast - # print >>sys.stderr, "%s- %s in %s" % (_DEBUG_lvls[lvl], string, cls) + # print("%s- %s in %s" % (_DEBUG_lvls[lvl], string, cls), + # file=sys.stderr) print("%s- %s in %s" % (_DEBUG_lvls[lvl], string, cls)) diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index c121f9ec5b36..b12abf4148cd 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -191,7 +191,7 @@ class Dvi(object): >>> with matplotlib.dviread.Dvi('input.dvi', 72) as dvi: >>> for page in dvi: - >>> print ''.join(unichr(t.glyph) for t in page.text) + >>> print(''.join(unichr(t.glyph) for t in page.text)) """ # dispatch table _dtable = [None for _ in xrange(256)] diff --git a/tutorials/intermediate/artists.py b/tutorials/intermediate/artists.py index 61bc929df0ba..aa5e04418edb 100644 --- a/tutorials/intermediate/artists.py +++ b/tutorials/intermediate/artists.py @@ -304,7 +304,7 @@ class in the matplotlib API, and the one you will be working with most # In [159]: ax1 # Out[159]: # -# In [160]: print fig.axes +# In [160]: print(fig.axes) # [, ] # # Because the figure maintains the concept of the "current axes" (see @@ -404,7 +404,7 @@ class in the matplotlib API, and the one you will be working with most # # .. sourcecode:: ipython # -# In [229]: print ax.lines +# In [229]: print(ax.lines) # [] # # Similarly, methods that create patches, like @@ -419,7 +419,7 @@ class in the matplotlib API, and the one you will be working with most # In [234]: rectangles # Out[234]: # -# In [235]: print len(ax.patches) +# In [235]: print(len(ax.patches)) # # You should not add objects directly to the ``Axes.lines`` or # ``Axes.patches`` lists unless you know exactly what you are doing, @@ -445,11 +445,11 @@ class in the matplotlib API, and the one you will be working with most # In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12) # # # by default the axes instance is None -# In [264]: print rect.get_axes() +# In [264]: print(rect.get_axes()) # None # # # and the transformation instance is set to the "identity transform" -# In [265]: print rect.get_transform() +# In [265]: print(rect.get_transform()) # # # # now we add the Rectangle to the Axes @@ -457,30 +457,30 @@ class in the matplotlib API, and the one you will be working with most # # # and notice that the ax.add_patch method has set the axes # # instance -# In [267]: print rect.get_axes() +# In [267]: print(rect.get_axes()) # Axes(0.125,0.1;0.775x0.8) # # # and the transformation has been set too -# In [268]: print rect.get_transform() +# In [268]: print(rect.get_transform()) # # # # the default axes transformation is ax.transData -# In [269]: print ax.transData +# In [269]: print(ax.transData) # # # # notice that the xlimits of the Axes have not been changed -# In [270]: print ax.get_xlim() +# In [270]: print(ax.get_xlim()) # (0.0, 1.0) # # # but the data limits have been updated to encompass the rectangle -# In [271]: print ax.dataLim.bounds +# In [271]: print(ax.dataLim.bounds) # (1.0, 1.0, 5.0, 12.0) # # # we can manually invoke the auto-scaling machinery # In [272]: ax.autoscale_view() # # # and now the xlim are updated to encompass the rectangle -# In [273]: print ax.get_xlim() +# In [273]: print(ax.get_xlim()) # (1.0, 6.0) # # # we have to manually force a figure draw From c5042fae730aa01c00d25f4f99023c6ee18b7421 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 12 Feb 2018 00:53:20 -0500 Subject: [PATCH 2/2] Remove print statements in dead comments. --- lib/matplotlib/lines.py | 4 ---- lib/mpl_toolkits/axisartist/angle_helper.py | 2 -- 2 files changed, 6 deletions(-) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index a9999b419f15..984f5b025f4b 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -93,25 +93,21 @@ def segment_hits(cx, cy, x, y, radius): Lnorm_sq = dx ** 2 + dy ** 2 # Possibly want to eliminate Lnorm==0 u = ((cx - xr) * dx + (cy - yr) * dy) / Lnorm_sq candidates = (u >= 0) & (u <= 1) - #if any(candidates): print "candidates",xr[candidates] # Note that there is a little area near one side of each point # which will be near neither segment, and another which will # be near both, depending on the angle of the lines. The # following radius test eliminates these ambiguities. point_hits = (cx - x) ** 2 + (cy - y) ** 2 <= radius ** 2 - #if any(point_hits): print "points",xr[candidates] candidates = candidates & ~(point_hits[:-1] | point_hits[1:]) # For those candidates which remain, determine how far they lie away # from the line. px, py = xr + u * dx, yr + u * dy line_hits = (cx - px) ** 2 + (cy - py) ** 2 <= radius ** 2 - #if any(line_hits): print "lines",xr[candidates] line_hits = line_hits & candidates points, = point_hits.ravel().nonzero() lines, = line_hits.ravel().nonzero() - #print points,lines return np.concatenate((points, lines)) diff --git a/lib/mpl_toolkits/axisartist/angle_helper.py b/lib/mpl_toolkits/axisartist/angle_helper.py index 4ca0a93fc81c..e69aacdb722b 100644 --- a/lib/mpl_toolkits/axisartist/angle_helper.py +++ b/lib/mpl_toolkits/axisartist/angle_helper.py @@ -114,11 +114,9 @@ def select_step(v1, v2, nv, hour=False, include_last=True, # for degree if dv > 1./threshold_factor: - #print "degree" step, factor = _select_step(dv) else: step, factor = select_step_sub(dv*threshold_factor) - #print "feac", step, factor factor = factor * threshold_factor