From 6c801785785df82e1b4508b4fe578b1c05886964 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Thu, 27 May 2021 23:02:50 -0400 Subject: [PATCH] Fix remaining E265 exceptions. This resolves the inconsistency that inline comments must start with a space (E262), but block comments are allowed not to. --- .flake8 | 2 +- doc/conf.py | 19 +++++++++---------- lib/matplotlib/backends/_backend_tk.py | 2 +- lib/matplotlib/backends/backend_gtk3.py | 1 - lib/matplotlib/backends/backend_template.py | 4 ++-- .../backends/qt_editor/_formlayout.py | 6 +++--- lib/matplotlib/lines.py | 2 +- lib/matplotlib/offsetbox.py | 5 ----- lib/matplotlib/text.py | 1 - lib/matplotlib/tri/triinterpolate.py | 4 ++-- lib/mpl_toolkits/axes_grid/__init__.py | 1 - lib/mpl_toolkits/axisartist/axis_artist.py | 2 +- .../axisartist/grid_helper_curvelinear.py | 4 ++-- lib/mpl_toolkits/mplot3d/axis3d.py | 2 +- 14 files changed, 23 insertions(+), 32 deletions(-) diff --git a/.flake8 b/.flake8 index 715729f93b63..f8e39f3c29c1 100644 --- a/.flake8 +++ b/.flake8 @@ -17,7 +17,7 @@ ignore = E121,E123,E126,E226,E24,E704,W503,W504, # Additional ignores: E122, E127, E131, - E265, E266, + E266, E305, E306, E722, E741, F841, diff --git a/doc/conf.py b/doc/conf.py index 7cfcb496e67c..18f1dc7545b4 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -230,7 +230,7 @@ def _check_dependencies(): # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. today_fmt = '%B %d, %Y' @@ -238,15 +238,15 @@ def _check_dependencies(): unused_docs = [] # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -268,16 +268,15 @@ def _check_dependencies(): # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. -#html_style = 'matplotlib.css' html_style = f'mpl.css?{SHA}' # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # The name of an image file (within the static path) to place at the top of # the sidebar. -#html_logo = 'logo.png' +# html_logo = 'logo.png' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, @@ -296,7 +295,7 @@ def _check_dependencies(): html_index = 'index.html' # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Custom sidebar templates, maps page names to templates. html_sidebars = { @@ -308,11 +307,11 @@ def _check_dependencies(): } # If false, no module index is generated. -#html_use_modindex = True +# html_use_modindex = True html_domain_indices = ["py-modindex"] # If true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True +# html_copy_source = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. diff --git a/lib/matplotlib/backends/_backend_tk.py b/lib/matplotlib/backends/_backend_tk.py index 2f13408cd0f3..01c8005cc7eb 100644 --- a/lib/matplotlib/backends/_backend_tk.py +++ b/lib/matplotlib/backends/_backend_tk.py @@ -690,7 +690,7 @@ def save_figure(self, *args): # asksaveasfilename dialog when you choose various save types # from the dropdown. Passing in the empty string seems to # work - JDH! - #defaultextension = self.canvas.get_default_filetype() + # defaultextension = self.canvas.get_default_filetype() defaultextension = '' initialdir = os.path.expanduser(mpl.rcParams['savefig.directory']) initialfile = self.canvas.get_default_filename() diff --git a/lib/matplotlib/backends/backend_gtk3.py b/lib/matplotlib/backends/backend_gtk3.py index bcdc7147160a..d066561fb422 100644 --- a/lib/matplotlib/backends/backend_gtk3.py +++ b/lib/matplotlib/backends/backend_gtk3.py @@ -144,7 +144,6 @@ def __init__(self, figure=None): style_ctx.add_class("matplotlib-canvas") def destroy(self): - #Gtk.DrawingArea.destroy(self) self.close_event() def scroll_event(self, widget, event): diff --git a/lib/matplotlib/backends/backend_template.py b/lib/matplotlib/backends/backend_template.py index 62888efd67e6..8d17f7d4e381 100644 --- a/lib/matplotlib/backends/backend_template.py +++ b/lib/matplotlib/backends/backend_template.py @@ -101,9 +101,9 @@ def points_to_pixels(self, points): # if backend doesn't have dpi, e.g., postscript or svg return points # elif backend assumes a value for pixels_per_inch - #return points/72.0 * self.dpi.get() * pixels_per_inch/72.0 + # return points/72.0 * self.dpi.get() * pixels_per_inch/72.0 # else - #return points/72.0 * self.dpi.get() + # return points/72.0 * self.dpi.get() class GraphicsContextTemplate(GraphicsContextBase): diff --git a/lib/matplotlib/backends/qt_editor/_formlayout.py b/lib/matplotlib/backends/qt_editor/_formlayout.py index 2f690a8e109c..8aed078c0ddf 100644 --- a/lib/matplotlib/backends/qt_editor/_formlayout.py +++ b/lib/matplotlib/backends/qt_editor/_formlayout.py @@ -554,7 +554,7 @@ def create_datagroup_example(): (datalist, "Category 2", "Category 2 comment"), (datalist, "Category 3", "Category 3 comment")) - #--------- datalist example + # --------- datalist example datalist = create_datalist_example() def apply_test(data): @@ -563,11 +563,11 @@ def apply_test(data): comment="This is just an example.", apply=apply_test)) - #--------- datagroup example + # --------- datagroup example datagroup = create_datagroup_example() print("result:", fedit(datagroup, "Global title")) - #--------- datagroup inside a datagroup example + # --------- datagroup inside a datagroup example datalist = create_datalist_example() datagroup = create_datagroup_example() print("result:", fedit(((datagroup, "Title 1", "Tab 1 comment"), diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 3f46a1e1e484..c96fc27c173d 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -309,7 +309,7 @@ def __init__(self, xdata, ydata, """ super().__init__() - #convert sequences to numpy arrays + # Convert sequences to NumPy arrays. if not np.iterable(xdata): raise RuntimeError('xdata must be a sequence') if not np.iterable(ydata): diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index b9ee7b031c69..646186891648 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -561,7 +561,6 @@ def draw(self, renderer): for c in self.get_visible_children(): c.draw(renderer) - #bbox_artist(self, renderer, fill=False, props=dict(pad=0.)) self.stale = False def update_frame(self, bbox, fontsize=None): @@ -1449,9 +1448,6 @@ def contains(self, mouseevent): if not self._check_xy(None): return False, {} return self.offsetbox.contains(mouseevent) - #if self.arrow_patch is not None: - # a, ainfo=self.arrow_patch.contains(event) - # t = t or a # self.arrow_patch is currently not checked as this can be a line - JJ def get_children(self): @@ -1534,7 +1530,6 @@ def _update_position_xybox(self, renderer, xy_pixel): # update patch position bbox = self.offsetbox.get_window_extent(renderer) - #self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h)) self.patch.set_bounds(bbox.x0, bbox.y0, bbox.width, bbox.height) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index 796c4f7bc1b3..9673f6ee6fc2 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -887,7 +887,6 @@ def get_window_extent(self, renderer=None, dpi=None): ``self.figure.dpi`` (*not* the renderer dpi); should be set e.g. if to match regions with a figure saved with a custom dpi value. """ - #return _unit_box if not self.get_visible(): return Bbox.unit() if dpi is None: diff --git a/lib/matplotlib/tri/triinterpolate.py b/lib/matplotlib/tri/triinterpolate.py index 9c8311892b2a..581477619fc1 100644 --- a/lib/matplotlib/tri/triinterpolate.py +++ b/lib/matplotlib/tri/triinterpolate.py @@ -1347,7 +1347,7 @@ def _cg(A, b, x0=None, tol=1.e-10, maxiter=1000): rho = np.dot(r, w) x = x + alpha*p beta = rho/rhoold - #err = np.linalg.norm(A.dot(x) - b) # absolute accuracy - not used + # err = np.linalg.norm(A.dot(x) - b) # absolute accuracy - not used k += 1 err = np.linalg.norm(A.dot(x) - b) return x, err @@ -1468,7 +1468,7 @@ def _pseudo_inv22sym_vectorized(M): tr = M[rank01, 0, 0] + M[rank01, 1, 1] tr_zeros = (np.abs(tr) < 1.e-8) sq_tr_inv = (1.-tr_zeros) / (tr**2+tr_zeros) - #sq_tr_inv = 1. / tr**2 + # sq_tr_inv = 1. / tr**2 M_inv[rank01, 0, 0] = M[rank01, 0, 0] * sq_tr_inv M_inv[rank01, 0, 1] = M[rank01, 0, 1] * sq_tr_inv M_inv[rank01, 1, 0] = M[rank01, 1, 0] * sq_tr_inv diff --git a/lib/mpl_toolkits/axes_grid/__init__.py b/lib/mpl_toolkits/axes_grid/__init__.py index 9e76d10ecbed..2a906781a1db 100644 --- a/lib/mpl_toolkits/axes_grid/__init__.py +++ b/lib/mpl_toolkits/axes_grid/__init__.py @@ -1,7 +1,6 @@ from . import axes_size as Size from .axes_divider import Divider, SubplotDivider, make_axes_locatable from .axes_grid import Grid, ImageGrid, AxesGrid -#from axes_divider import make_axes_locatable from matplotlib import _api _api.warn_deprecated(since='2.1', name='mpl_toolkits.axes_grid', diff --git a/lib/mpl_toolkits/axisartist/axis_artist.py b/lib/mpl_toolkits/axisartist/axis_artist.py index f1e323549372..15e719508584 100644 --- a/lib/mpl_toolkits/axisartist/axis_artist.py +++ b/lib/mpl_toolkits/axisartist/axis_artist.py @@ -648,7 +648,7 @@ def __init__(self, axes, axes : `mpl_toolkits.axisartist.axislines.Axes` helper : `~mpl_toolkits.axisartist.axislines.AxisArtistHelper` """ - #axes is also used to follow the axis attribute (tick color, etc). + # axes is also used to follow the axis attribute (tick color, etc). super().__init__(**kwargs) diff --git a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py index 0075d1f411ac..8ae8c0f0e0cb 100644 --- a/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py +++ b/lib/mpl_toolkits/axisartist/grid_helper_curvelinear.py @@ -193,11 +193,11 @@ def get_tick_iterators(self, axes): if self.nth_coord == 0: mask = (e0 <= yy0) & (yy0 <= e1) - #xx0, yy0 = xx0[mask], yy0[mask] + # xx0, yy0 = xx0[mask], yy0[mask] yy0 = yy0[mask] elif self.nth_coord == 1: mask = (e0 <= xx0) & (xx0 <= e1) - #xx0, yy0 = xx0[mask], yy0[mask] + # xx0, yy0 = xx0[mask], yy0[mask] xx0 = xx0[mask] def transform_xy(x, y): diff --git a/lib/mpl_toolkits/mplot3d/axis3d.py b/lib/mpl_toolkits/mplot3d/axis3d.py index 86d8e3b183a1..adced6f4c21d 100644 --- a/lib/mpl_toolkits/mplot3d/axis3d.py +++ b/lib/mpl_toolkits/mplot3d/axis3d.py @@ -347,7 +347,7 @@ def draw(self, renderer): # the alignment point is used as the "fulcrum" for rotation. self.offsetText.set_rotation_mode('anchor') - #---------------------------------------------------------------------- + # ---------------------------------------------------------------------- # Note: the following statement for determining the proper alignment of # the offset text. This was determined entirely by trial-and-error # and should not be in any way considered as "the way". There are