Skip to content

Commit

Permalink
add error codes to noqa pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfikl authored and inducer committed Aug 12, 2023
1 parent 26e73e9 commit 86da3c1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions meshmode/discretization/connection/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@
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
in a discretization.
"""


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)
Expand Down
4 changes: 2 additions & 2 deletions meshmode/discretization/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meshmode/interop/firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
THE SOFTWARE.
"""

from warnings import warn # noqa
from warnings import warn
import logging
import numpy as np

Expand Down
2 changes: 1 addition & 1 deletion meshmode/mesh/generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions meshmode/mesh/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion meshmode/mesh/refinement/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/test_meshmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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.

# }}}
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 86da3c1

Please sign in to comment.