From 55e25b4138e1adc02b8fe94a745f888d200054a3 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Fri, 19 Jul 2024 14:52:31 +0300 Subject: [PATCH 1/2] add typos ci and fix issues --- .github/workflows/ci.yml | 7 +++++++ examples/helmholtz-dirichlet.py | 6 +++--- examples/scaling-study.py | 6 +++--- pyproject.toml | 5 +++++ pytential/collection.py | 2 +- pytential/linalg/skeletonization.py | 2 +- pytential/linalg/utils.py | 2 +- pytential/symbolic/primitives.py | 2 +- test/extra_int_eq_data.py | 12 ++++++------ test/test_tools.py | 2 +- 10 files changed, 29 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 98c98d9c6..ccd602eea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,13 @@ concurrency: cancel-in-progress: true jobs: + typos: + name: Typos + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@master + ruff: name: Ruff runs-on: ubuntu-latest diff --git a/examples/helmholtz-dirichlet.py b/examples/helmholtz-dirichlet.py index 173c9c7ba..6b34812af 100644 --- a/examples/helmholtz-dirichlet.py +++ b/examples/helmholtz-dirichlet.py @@ -53,9 +53,9 @@ def main(mesh_name="ellipse", visualize=False): affine_map( base_mesh, A=np.diag([dx*0.25, dx*0.25]), - b=np.array([dx*(ix-nx/2), dx*(iy-ny/2)])) - for ix in range(nx) - for iy in range(ny)] + b=np.array([dx*(i_x-nx/2), dx*(i_y-ny/2)])) + for i_x in range(nx) + for i_y in range(ny)] mesh = merge_disjoint_meshes(meshes, single_group=True) diff --git a/examples/scaling-study.py b/examples/scaling-study.py index 930541e5b..047b50578 100644 --- a/examples/scaling-study.py +++ b/examples/scaling-study.py @@ -36,9 +36,9 @@ def make_mesh(nx, ny, visualize=False): affine_map( base_mesh, A=np.diag([dx*0.25, dx*0.25]), - b=np.array([dx*(ix-nx/2), dx*(iy-ny/2)])) - for ix in range(nx) - for iy in range(ny)] + b=np.array([dx*(i_x-nx/2), dx*(i_y-ny/2)])) + for i_x in range(nx) + for i_y in range(ny)] mesh = merge_disjoint_meshes(meshes, single_group=True) diff --git a/pyproject.toml b/pyproject.toml index 68787fd7b..6c1ff6895 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -139,6 +139,11 @@ markers = [ "slowtest: mark a test as slow", ] +[tool.typos.default] +extend-ignore-re = [ + "(?Rm)^.*(#|//)\\s*spellchecker:\\s*disable-line$" +] + [tool.mypy] python_version = "3.8" warn_unused_ignores = true diff --git a/pytential/collection.py b/pytential/collection.py index 7303f1a6a..cedcab3ce 100644 --- a/pytential/collection.py +++ b/pytential/collection.py @@ -385,7 +385,7 @@ def add_geometry_to_collection( This function is similar to :meth:`GeometryCollection.merge`, but it makes an attempt to maintain the caches in *places*. In particular, a shallow - copy of the following are pased to the new collection + copy of the following are passed to the new collection * Any cached discretizations from :func:`~pytential.qbx.refinement.refine_geometry_collection`. diff --git a/pytential/linalg/skeletonization.py b/pytential/linalg/skeletonization.py index b36dbba0e..cbadefc26 100644 --- a/pytential/linalg/skeletonization.py +++ b/pytential/linalg/skeletonization.py @@ -192,7 +192,7 @@ class SkeletonizationWrangler: An :class:`~numpy.ndarray` of shape ``(nrows,)`` of expressions (layer potentials) that correspond to the output blocks of the matrix. - These expressions are tagged for nearfield neighbor evalution. + These expressions are tagged for nearfield neighbor evaluation. .. attribute:: source_proxy_exprs .. attribute:: target_proxy_exprs diff --git a/pytential/linalg/utils.py b/pytential/linalg/utils.py index beb671cd8..9900eb2f2 100644 --- a/pytential/linalg/utils.py +++ b/pytential/linalg/utils.py @@ -457,7 +457,7 @@ def skeletonization_error( tgt_src_index = skeleton.tgt_src_index skel_tgt_src_index = skeleton.skel_tgt_src_index - # {{{ contruct matrices + # {{{ construct matrices # NOTE: the diagonal should be the same by definition skl = mat.copy() diff --git a/pytential/symbolic/primitives.py b/pytential/symbolic/primitives.py index d7aea4397..9447573f4 100644 --- a/pytential/symbolic/primitives.py +++ b/pytential/symbolic/primitives.py @@ -972,7 +972,7 @@ def _source_danger_zone_radii(ambient_dim, dim=None, # This should be the expression of the expansion radii, but # # - in reference to the stage 2 discretization - # - mutliplied by 0.75 because + # - multiplied by 0.75 because # # - Setting this equal to the expansion radii ensures that *every* # stage 2 element will be refined, which is wasteful. diff --git a/test/extra_int_eq_data.py b/test/extra_int_eq_data.py index 3081047b5..a6ddbf037 100644 --- a/test/extra_int_eq_data.py +++ b/test/extra_int_eq_data.py @@ -570,12 +570,12 @@ def get_mesh(self, resolution, mesh_order): base_mesh, A=rand_rotation_matrix(3), b=self.pitch*np.array([ - (ix-self.nx//2), - (iy-self.ny//2), - (iz-self.ny//2)])) - for ix in range(self.nx) - for iy in range(self.ny) - for iz in range(self.nz) + (i_x-self.nx//2), + (i_y-self.ny//2), + (i_z-self.ny//2)])) + for i_x in range(self.nx) + for i_y in range(self.ny) + for i_z in range(self.nz) ] return merge_disjoint_meshes(meshes, single_group=True) diff --git a/test/test_tools.py b/test/test_tools.py index afb0792b5..360313188 100644 --- a/test/test_tools.py +++ b/test/test_tools.py @@ -249,7 +249,7 @@ def test_add_geometry_to_collection(actx_factory): Test case of `add_geometry_to_collection`. Verifies that * cse_scope.DISCRETIZATION caches stick around * refinement / connection caches stick around - * caches added to the new collection don't polute the original one + * caches added to the new collection don't pollute the original one """ actx = actx_factory() From f3eb79053c51f3790f69697bd6185a9d0cb2ef75 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Fri, 19 Jul 2024 15:45:24 +0300 Subject: [PATCH 2/2] mypy: ignore sympy --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 6c1ff6895..5c1842bfe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -166,5 +166,6 @@ module = [ "pytest.*", "scipy.*", "sumpy.*", + "sympy.*", ] ignore_missing_imports = true