From 86da3c1204912233e4d62042b0002dba925ae264 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Thu, 10 Aug 2023 20:33:31 +0300 Subject: [PATCH] add error codes to noqa pragmas --- meshmode/discretization/connection/face.py | 4 ++-- meshmode/discretization/visualization.py | 4 ++-- meshmode/interop/firedrake/mesh.py | 2 +- meshmode/mesh/generation.py | 2 +- meshmode/mesh/io.py | 7 ++++--- meshmode/mesh/refinement/utils.py | 2 +- test/test_meshmode.py | 10 +++++----- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/meshmode/discretization/connection/face.py b/meshmode/discretization/connection/face.py index c93e2133d..ae03cb58e 100644 --- a/meshmode/discretization/connection/face.py +++ b/meshmode/discretization/connection/face.py @@ -31,7 +31,7 @@ logger = logging.getLogger(__name__) -class FACE_RESTR_INTERIOR: # noqa +class FACE_RESTR_INTERIOR: # noqa: N801 """A special value to pass to :func:`meshmode.discretization.connection.make_face_restriction` to produce a discretization consisting of all interior faces @@ -39,7 +39,7 @@ class FACE_RESTR_INTERIOR: # noqa """ -class FACE_RESTR_ALL: # noqa +class FACE_RESTR_ALL: # noqa: N801 """A special value to pass to :func:`meshmode.discretization.connection.make_face_restriction` to produce a discretization consisting of all faces (interior and boundary) diff --git a/meshmode/discretization/visualization.py b/meshmode/discretization/visualization.py index 8ddfc0518..035cdd6f9 100644 --- a/meshmode/discretization/visualization.py +++ b/meshmode/discretization/visualization.py @@ -584,7 +584,7 @@ def show_scalar_in_mayavi(self, field, **kwargs): args = tuple(nodes) + (field,) - # https://docs.enthought.com/mayavi/mayavi/auto/example_plotting_many_lines.html # noqa + # https://docs.enthought.com/mayavi/mayavi/auto/example_plotting_many_lines.html # noqa: E501 src = mlab.pipeline.scalar_scatter(*args) src.mlab_source.dataset.lines = vis_connectivity.reshape(-1, 2) @@ -736,7 +736,7 @@ def write_vtk_file(self, file_name, names_and_fields, - Added *par_manifest_filename* and *par_file_names*. - Added *use_high_order*. - """ # noqa + """ # noqa: E501 if use_high_order is None: use_high_order = False diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 35dec0b52..20ee7c738 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -20,7 +20,7 @@ THE SOFTWARE. """ -from warnings import warn # noqa +from warnings import warn import logging import numpy as np diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index 23f1c933d..16f83c120 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -824,7 +824,7 @@ def idx(i: int, j: int) -> int: # {{{ evaluate on torus - # https://web.archive.org/web/20160410151837/https://www.math.hmc.edu/~gu/curves_and_surfaces/surfaces/torus.html # noqa + # https://web.archive.org/web/20160410151837/https://www.math.hmc.edu/~gu/curves_and_surfaces/surfaces/torus.html # noqa: E501 # create new vertices without the endpoints u = np.linspace(0.0, 2.0 * np.pi, n_major, endpoint=False) diff --git a/meshmode/mesh/io.py b/meshmode/mesh/io.py index 1f03dc0ee..4eb522117 100644 --- a/meshmode/mesh/io.py +++ b/meshmode/mesh/io.py @@ -22,7 +22,7 @@ import numpy as np -from gmsh_interop.reader import ( # noqa +from gmsh_interop.reader import ( # noqa: F401 GmshMeshReceiverBase, ScriptSource, FileSource, LiteralSource, ScriptWithFilesSource, GmshSimplexElementBase, @@ -283,6 +283,9 @@ def get_mesh(self, return_tag_to_elements_map=False): # {{{ gmsh +AXIS_NAMES = "xyz" + + def read_gmsh( filename, force_ambient_dim=None, mesh_construction_kwargs=None, return_tag_to_elements_map=False): @@ -351,8 +354,6 @@ def generate_gmsh(source, dimensions=None, order=None, other_options=None, else: mesh = result - AXIS_NAMES = "xyz" # noqa - dim = mesh.vertices.shape[0] for idim in range(dim): if (mesh.vertices[idim] == 0).all(): diff --git a/meshmode/mesh/refinement/utils.py b/meshmode/mesh/refinement/utils.py index ad743242c..24ff85447 100644 --- a/meshmode/mesh/refinement/utils.py +++ b/meshmode/mesh/refinement/utils.py @@ -166,7 +166,7 @@ def group_and_iel_to_global_iel(igrp, iel): nearby_grp = mesh.groups[nearby_igrp] nearby_origin_vertex = mesh.vertices[ - :, nearby_grp.vertex_indices[nearby_iel][0]] # noqa + :, nearby_grp.vertex_indices[nearby_iel][0]] transformation = np.empty( (len(mesh.vertices), nvertices_per_element-1)) vertex_transformed = vertex - nearby_origin_vertex diff --git a/test/test_meshmode.py b/test/test_meshmode.py index 72d15ec35..846ee00ca 100644 --- a/test/test_meshmode.py +++ b/test/test_meshmode.py @@ -466,7 +466,7 @@ def f(x): # {{{ element orientation: canned 3D meshes -# python test_meshmode.py "test_sanity_balls(cl._csc, "disk-radius-1.step", 2, 2, visualize=True)" # noqa +# python test_meshmode.py "test_sanity_balls(cl._csc, "disk-radius-1.step", 2, 2, visualize=True)" # noqa: E501 @pytest.mark.parametrize(("what", "mesh_gen_func"), [ ("ball", lambda: mgen.generate_icosahedron(1, 1)), ("torus", lambda: mgen.generate_torus(5, 1)), @@ -579,7 +579,7 @@ def test_sanity_single_element(actx_factory, dim, mesh_order, group_cls, nodes = actx.thaw(vol_discr.nodes()) vol_one = 1 + 0 * nodes[0] - from pytential import norm, integral # noqa + from pytential import integral comp_vol = integral(vol_discr, vol_one) rel_vol_err = abs(true_vol - comp_vol) / true_vol @@ -663,7 +663,7 @@ def test_sanity_no_elements(actx_factory, dim, mesh_order, group_cls, nodes = actx.thaw(vol_discr.nodes()) vol_one = 1 + 0 * nodes[0] - from pytential import norm, integral # noqa + from pytential import integral assert integral(vol_discr, vol_one) == 0. # }}} @@ -741,7 +741,7 @@ def f(x): # {{{ sanity checks: ball meshes -# python test_meshmode.py "test_sanity_balls(cl._csc, "disk-radius-1.step", 2, 2, visualize=True)" # noqa +# python test_meshmode.py "test_sanity_balls(cl._csc, "disk-radius-1.step", 2, 2, visualize=True)" # noqa: E501 @pytest.mark.parametrize(("src_file", "dim"), [ ("disk-radius-1.step", 2), ("ball-radius-1.step", 3), @@ -799,7 +799,7 @@ def test_sanity_balls(actx_factory, src_file, dim, mesh_order, visualize=False): vol_x = actx.thaw(vol_discr.nodes()) vol_one = vol_x[0]*0 + 1 - from pytential import norm, integral # noqa + from pytential import integral, norm comp_vol = actx.to_numpy(integral(vol_discr, vol_one)) rel_vol_err = abs(true_vol - comp_vol) / true_vol