diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index 21afc1c2..9fb9d931 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -24901,22 +24901,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownMemberType", - "range": { - "startColumn": 4, - "endColumn": 16, - "lineCount": 1 - } - }, - { - "code": "reportUnknownMemberType", - "range": { - "startColumn": 4, - "endColumn": 16, - "lineCount": 1 - } - }, { "code": "reportUnknownMemberType", "range": { diff --git a/meshmode/interop/firedrake/connection.py b/meshmode/interop/firedrake/connection.py index 1761ba11..420ec70e 100644 --- a/meshmode/interop/firedrake/connection.py +++ b/meshmode/interop/firedrake/connection.py @@ -238,7 +238,7 @@ def __init__(self, discr, fdrake_fspace, mm2fd_node_mapping, group_nr=None): @memoize_method def firedrake_fspace(self, shape=None): - """ + r""" Return a firedrake function space that *self.discr.groups[self.group_nr]* is connected to of the appropriate vector dimension diff --git a/meshmode/interop/firedrake/mesh.py b/meshmode/interop/firedrake/mesh.py index 7e36025e..c3ee68c8 100644 --- a/meshmode/interop/firedrake/mesh.py +++ b/meshmode/interop/firedrake/mesh.py @@ -503,7 +503,7 @@ def _get_firedrake_orientations(fdrake_mesh, unflipped_group, vertices, def import_firedrake_mesh(fdrake_mesh, cells_to_use=None, normals=None, no_normals_warn=None): - """ + r""" Create a :class:`meshmode.mesh.Mesh` from a `firedrake.mesh.MeshGeometry` with the same cells/elements, vertices, nodes, diff --git a/meshmode/mesh/__init__.py b/meshmode/mesh/__init__.py index 571d29aa..e752da13 100644 --- a/meshmode/mesh/__init__.py +++ b/meshmode/mesh/__init__.py @@ -1417,7 +1417,7 @@ def nodal_adjacency(self) -> NodalAdjacency: ) nodal_adjacency = _compute_nodal_adjacency_from_vertices(self) - object.__setattr__(self, "_nodal_adjacency", nodal_adjacency) + object.__setattr__(self, "_nodal_adjacency", nodal_adjacency) # ruff: ignore[unnecessary-dunder-call] return nodal_adjacency @@ -1485,7 +1485,7 @@ def facial_adjacency_groups( facial_adjacency_groups = _compute_facial_adjacency_from_vertices( self.groups, self.element_id_dtype, self.face_id_dtype) - object.__setattr__(self, "_facial_adjacency_groups", + object.__setattr__(self, "_facial_adjacency_groups", # ruff: ignore[unnecessary-dunder-call] facial_adjacency_groups) else: facial_adjacency_groups = fagrps_in diff --git a/meshmode/mesh/generation.py b/meshmode/mesh/generation.py index a7f0ec9d..d62a5038 100644 --- a/meshmode/mesh/generation.py +++ b/meshmode/mesh/generation.py @@ -603,10 +603,11 @@ def generate_icosahedron( tris: list[list[int]] = [] m = len(top_ring) for i in range(m): - tris.append([top_ring[i], top_ring[(i+1) % m], top_point]) - tris.append([bottom_ring[i], bottom_point, bottom_ring[(i+1) % m], ]) - tris.append([bottom_ring[i], bottom_ring[(i+1) % m], top_ring[i]]) - tris.append([top_ring[i], bottom_ring[(i+1) % m], top_ring[(i+1) % m]]) + tris.extend(( + [top_ring[i], top_ring[(i + 1) % m], top_point], + [bottom_ring[i], bottom_point, bottom_ring[(i + 1) % m]], + [bottom_ring[i], bottom_ring[(i + 1) % m], top_ring[i]], + [top_ring[i], bottom_ring[(i + 1) % m], top_ring[(i + 1) % m]])) vertices *= r/la.norm(vertices[:, 0]) @@ -770,8 +771,9 @@ def generate_surface_of_revolution( tris: list[list[int]] = [] for i in range(m-1): for j in range(n): - tris.append([i*n + j, (i + 1)*n + j, (i + 1)*n + (j + 1) % n]) - tris.append([i*n + j, i*n + (j + 1) % n, (i + 1)*n + (j + 1) % n]) + tris.extend(( + [i * n + j, (i + 1) * n + j, (i + 1) * n + (j + 1) % n], + [i * n + j, i * n + (j + 1) % n, (i + 1) * n + (j + 1) % n])) vertex_indices = np.array(tris, dtype=np.int32) diff --git a/meshmode/mesh/visualization.py b/meshmode/mesh/visualization.py index f4e03c1a..6b7b7f2d 100644 --- a/meshmode/mesh/visualization.py +++ b/meshmode/mesh/visualization.py @@ -310,9 +310,10 @@ def write_vertex_vtk_file( def mesh_to_tikz(mesh: Mesh) -> str: lines = [] - lines.append(fr"\def\nelements{{{mesh.nelements}}}") - lines.append(fr"\def\nvertices{{{mesh.nvertices}}}") - lines.append("") + lines.extend(( + rf"\def\nelements{{{mesh.nelements}}}", + rf"\def\nvertices{{{mesh.nvertices}}}", + "")) drawel_lines = [] drawel_lines.append(r"\def\drawelements#1{") diff --git a/pyproject.toml b/pyproject.toml index 1de52795..c149958a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,6 +102,7 @@ extend-ignore = [ "non-empty-init-module", "type-check-without-type-error", "collapsible-if", + "pytest-parameter-with-default-argument", ] [tool.ruff.lint.flake8-quotes] diff --git a/test/test_mesh.py b/test/test_mesh.py index ae62b153..ea7e3e45 100644 --- a/test/test_mesh.py +++ b/test/test_mesh.py @@ -1412,10 +1412,10 @@ def gen_rect_mesh_with_perturbed_vertices( actx, vol_discr, group_factory, FACE_RESTR_ALL, per_face_groups=False) # Element vertex indices rotated + vol_mesh_unrotated = mgen.generate_regular_rect_mesh( + a=(-1,)*2, b=(1,)*2, + nelements_per_axis=(8,)*2) with pytest.raises(InconsistentVerticesError): - vol_mesh_unrotated = mgen.generate_regular_rect_mesh( - a=(-1,)*2, b=(1,)*2, - nelements_per_axis=(8,)*2) vol_mesh = vol_mesh_unrotated.copy( groups=[ replace( diff --git a/test/test_modal.py b/test/test_modal.py index 4a9f82ff..9d4accc7 100644 --- a/test/test_modal.py +++ b/test/test_modal.py @@ -160,7 +160,7 @@ def f(x): w_diag = np.diag(quad.weights) modal_data = [] - for _, nodal_data in enumerate(nodal_f_data): + for nodal_data in nodal_f_data: # Compute modal data in each element: V.T * W * nodal_data elem_modal_f = np.dot(vdm.T, np.dot(w_diag, nodal_data)) modal_data.append(elem_modal_f) diff --git a/test/test_partition.py b/test/test_partition.py index 946cfd43..5fc94a1d 100644 --- a/test/test_partition.py +++ b/test/test_partition.py @@ -117,8 +117,8 @@ def f(x): for i_local_part, part_mesh in part_meshes.items(): from meshmode.distributed import get_connected_parts neighbors = get_connected_parts(part_mesh) - for i_remote_part in neighbors: - connected_parts.add((i_local_part, i_remote_part)) + connected_parts.update((i_local_part, i_remote_part) + for i_remote_part in neighbors) from meshmode.discretization import Discretization vol_discrs = [Discretization(actx, part_mesh, group_factory) @@ -259,8 +259,8 @@ def test_partition_mesh(mesh_size, num_parts, num_groups, dim, scramble_parts): for i_local_part in range(num_parts): from meshmode.distributed import get_connected_parts neighbors = get_connected_parts(part_meshes[i_local_part]) - for i_remote_part in neighbors: - connected_parts.add((i_local_part, i_remote_part)) + connected_parts.update((i_local_part, i_remote_part) + for i_remote_part in neighbors) from meshmode.mesh import BTAG_PARTITION from meshmode.mesh.processing import find_group_indices