diff --git a/.basedpyright/baseline.json b/.basedpyright/baseline.json index fa3f4c231..203432843 100644 --- a/.basedpyright/baseline.json +++ b/.basedpyright/baseline.json @@ -1,22 +1,6 @@ { "files": { "./examples/fmm-error.py": [ - { - "code": "reportUnusedImport", - "range": { - "startColumn": 37, - "endColumn": 41, - "lineCount": 1 - } - }, - { - "code": "reportUnusedImport", - "range": { - "startColumn": 43, - "endColumn": 50, - "lineCount": 1 - } - }, { "code": "reportUnknownArgumentType", "range": { @@ -745,14 +729,6 @@ } ], "./examples/layerpot-3d.py": [ - { - "code": "reportUnusedImport", - "range": { - "startColumn": 57, - "endColumn": 66, - "lineCount": 1 - } - }, { "code": "reportMissingParameterType", "range": { @@ -803,30 +779,6 @@ } ], "./examples/layerpot.py": [ - { - "code": "reportUnusedImport", - "range": { - "startColumn": 37, - "endColumn": 41, - "lineCount": 1 - } - }, - { - "code": "reportUnusedImport", - "range": { - "startColumn": 43, - "endColumn": 50, - "lineCount": 1 - } - }, - { - "code": "reportUnusedImport", - "range": { - "startColumn": 57, - "endColumn": 66, - "lineCount": 1 - } - }, { "code": "reportMissingParameterType", "range": { @@ -1385,14 +1337,6 @@ } ], "./pytential/array_context.py": [ - { - "code": "reportUnusedImport", - "range": { - "startColumn": 4, - "endColumn": 22, - "lineCount": 1 - } - }, { "code": "reportUnknownVariableType", "range": { @@ -27913,22 +27857,6 @@ "lineCount": 1 } }, - { - "code": "reportUnknownArgumentType", - "range": { - "startColumn": 52, - "endColumn": 57, - "lineCount": 1 - } - }, - { - "code": "reportUnknownVariableType", - "range": { - "startColumn": 63, - "endColumn": 68, - "lineCount": 1 - } - }, { "code": "reportUnknownMemberType", "range": { @@ -28141,14 +28069,6 @@ } ], "./pytential/symbolic/dof_connection.py": [ - { - "code": "reportUnusedImport", - "range": { - "startColumn": 16, - "endColumn": 18, - "lineCount": 1 - } - }, { "code": "reportUnreachable", "range": { @@ -28633,14 +28553,6 @@ "lineCount": 1 } }, - { - "code": "reportAbstractUsage", - "range": { - "startColumn": 19, - "endColumn": 18, - "lineCount": 4 - } - }, { "code": "reportCallIssue", "range": { @@ -28769,14 +28681,6 @@ "lineCount": 1 } }, - { - "code": "reportAbstractUsage", - "range": { - "startColumn": 19, - "endColumn": 18, - "lineCount": 4 - } - }, { "code": "reportCallIssue", "range": { @@ -43997,6 +43901,14 @@ "lineCount": 1 } }, + { + "code": "reportUnnecessaryTypeIgnoreComment", + "range": { + "startColumn": 97, + "endColumn": 117, + "lineCount": 1 + } + }, { "code": "reportUnknownVariableType", "range": { @@ -44005,6 +43917,38 @@ "lineCount": 1 } }, + { + "code": "reportUnknownVariableType", + "range": { + "startColumn": 12, + "endColumn": 18, + "lineCount": 1 + } + }, + { + "code": "reportOptionalSubscript", + "range": { + "startColumn": 21, + "endColumn": 48, + "lineCount": 1 + } + }, + { + "code": "reportUnknownMemberType", + "range": { + "startColumn": 49, + "endColumn": 70, + "lineCount": 1 + } + }, + { + "code": "reportUnknownArgumentType", + "range": { + "startColumn": 49, + "endColumn": 55, + "lineCount": 1 + } + }, { "code": "reportUnknownMemberType", "range": { diff --git a/doc/conf.py b/doc/conf.py index a6a727a03..d01a43fc6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -106,7 +106,7 @@ "P2P": "class:sumpy.p2p.P2P", "P2PBase": "class:sumpy.p2p.P2PBase", "FMMLevelToOrder": "class:sumpy.fmm.FMMLevelToOrder", - "MultipoleExpansionFromOrderFactory": "class:sumpy.fmm.MultipoleExpansionFromOrderFactory", # noqa: E501 + "MultipoleExpansionFromOrderFactory": "class:sumpy.fmm.MultipoleExpansionFromOrderFactory", # ruff:ignore[line-too-long] "LocalExpansionFromOrderFactory": "class:sumpy.fmm.LocalExpansionFromOrderFactory", # pytential "DOFDescriptorLike": "data:pytential.symbolic.dof_desc.DOFDescriptorLike", @@ -123,8 +123,8 @@ "Side": "obj:pytential.symbolic.primitives.Side", "TargetOrDiscretization": "obj:pytential.target.TargetOrDiscretization", "VectorExpression": "obj:pytential.symbolic.pde.scalar.VectorExpression", - "pytential.symbolic.dof_desc.DOFDescriptorLike": "data:pytential.symbolic.dof_desc.DOFDescriptorLike", # noqa: E501 - "pytential.symbolic.primitives.ExpressionNode": "class:pytential.symbolic.primitives.ExpressionNode", # noqa: E501 + "pytential.symbolic.dof_desc.DOFDescriptorLike": "data:pytential.symbolic.dof_desc.DOFDescriptorLike", # ruff:ignore[line-too-long] + "pytential.symbolic.primitives.ExpressionNode": "class:pytential.symbolic.primitives.ExpressionNode", # ruff:ignore[line-too-long] "sym.DOFDescriptor": "class:pytential.symbolic.dof_desc.DOFDescriptor", "sym.IntG": "class:pytential.symbolic.primitives.IntG", "sym.var": "obj:pytential.symbolic.primitives.var", @@ -132,4 +132,4 @@ def setup(app): - app.connect("missing-reference", process_autodoc_missing_reference) # noqa: F821 + app.connect("missing-reference", process_autodoc_missing_reference) # ruff:ignore[undefined-name] diff --git a/examples/fmm-error.py b/examples/fmm-error.py index cfea582ec..89aba706f 100644 --- a/examples/fmm-error.py +++ b/examples/fmm-error.py @@ -1,6 +1,11 @@ import numpy as np -from meshmode.mesh.generation import drop, ellipse, make_curve_mesh, starfish # noqa +from meshmode.mesh.generation import ( # ruff:ignore[unused-import] + drop, + ellipse, + make_curve_mesh, + starfish, +) from sumpy.kernel import HelmholtzKernel, LaplaceKernel from sumpy.visualization import FieldPlotter diff --git a/examples/layerpot-3d.py b/examples/layerpot-3d.py index ebe456bd9..4afe71c9e 100644 --- a/examples/layerpot-3d.py +++ b/examples/layerpot-3d.py @@ -1,6 +1,10 @@ import numpy as np -from sumpy.kernel import HelmholtzKernel, LaplaceKernel, OneKernel # noqa +from sumpy.kernel import ( # ruff:ignore[unused-import] + HelmholtzKernel, + LaplaceKernel, + OneKernel, +) from sumpy.visualization import FieldPlotter from pytential import bind, sym diff --git a/examples/layerpot.py b/examples/layerpot.py index 647479490..c91b2d591 100644 --- a/examples/layerpot.py +++ b/examples/layerpot.py @@ -1,7 +1,15 @@ import numpy as np -from meshmode.mesh.generation import drop, ellipse, starfish # noqa: F401 -from sumpy.kernel import HelmholtzKernel, LaplaceKernel, OneKernel # noqa: F401 +from meshmode.mesh.generation import ( # ruff:ignore[unused-import] + drop, + ellipse, + starfish, +) +from sumpy.kernel import ( # ruff:ignore[unused-import] + HelmholtzKernel, + LaplaceKernel, + OneKernel, +) from sumpy.visualization import FieldPlotter from pytential import bind, sym diff --git a/pyproject.toml b/pyproject.toml index f150046d2..f4e486cbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,14 +91,14 @@ extend-select = [ ] extend-ignore = [ "C90", # McCabe complexity - "E226", # missing whitespace around arithmetic operator - "E402", # module level import not at the top of file - "N802", # function name should be lowercase - "N803", # argument name should be lowercase - "N806", # variable name should be lowercase - "RUF067", # non-empty-init-module - "UP031", # use f-strings instead of % - "UP032", # use f-strings instead of .format + "missing-whitespace-around-arithmetic-operator", + "module-import-not-at-top-of-file", + "invalid-function-name", + "invalid-argument-name", + "non-lowercase-variable-in-function", + "non-empty-init-module", + "printf-string-formatting", + "f-string", ] exclude = [ "experiments/*.py", @@ -107,9 +107,9 @@ exclude = [ ] [tool.ruff.lint.per-file-ignores] -"doc/*.py" = ["I002", "S102"] -"examples/*.py" = ["I002"] -"test/test_*.py" = ["S102"] +"doc/*.py" = ["missing-required-import", "exec-builtin"] +"examples/*.py" = ["missing-required-import"] +"test/test_*.py" = ["exec-builtin"] [tool.ruff.lint.flake8-quotes] docstring-quotes = "double" @@ -162,6 +162,9 @@ reportImportCycles = "none" reportPrivateUsage = "hint" +# covered by ruff +reportUnusedImport = "none" + pythonVersion = "3.12" pythonPlatform = "All" @@ -199,4 +202,3 @@ reportPrivateImportUsage = "hint" reportPrivateUsage = "hint" reportUnknownLambdaType = "hint" reportMissingTypeStubs = "hint" -reportUnusedImport = "none" diff --git a/pytential/array_context.py b/pytential/array_context.py index e322c58ee..cfe643ce1 100644 --- a/pytential/array_context.py +++ b/pytential/array_context.py @@ -31,7 +31,7 @@ _PytestPyOpenCLArrayContextFactoryWithClass, register_pytest_array_context_factory, ) -from sumpy.array_context import ( # noqa: F401 +from sumpy.array_context import ( # ruff:ignore[unused-import] PyOpenCLArrayContext as PyOpenCLArrayContextBase, make_loopy_program, ) diff --git a/pytential/linalg/direct_solver_symbolic.py b/pytential/linalg/direct_solver_symbolic.py index c0893e83c..23cb7cd70 100644 --- a/pytential/linalg/direct_solver_symbolic.py +++ b/pytential/linalg/direct_solver_symbolic.py @@ -53,11 +53,11 @@ # {{{ utils -class PROXY_SKELETONIZATION_SOURCE: # noqa: N801 +class PROXY_SKELETONIZATION_SOURCE: # ruff:ignore[invalid-class-name] pass -class PROXY_SKELETONIZATION_TARGET: # noqa: N801 +class PROXY_SKELETONIZATION_TARGET: # ruff:ignore[invalid-class-name] pass diff --git a/pytential/log.py b/pytential/log.py index 9ab570f56..6ed8b3b2a 100644 --- a/pytential/log.py +++ b/pytential/log.py @@ -39,11 +39,11 @@ # {{{ constants -class colors: # noqa +class colors: # ruff:ignore[invalid-class-name] BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8) -class term_seq: # noqa +class term_seq: # ruff:ignore[invalid-class-name] RESET_SEQ = "\033[0m" COLOR_SEQ = "\033[1;%dm" BOLD_SEQ = "\033[1m" diff --git a/pytential/qbx/cost.py b/pytential/qbx/cost.py index 8b7560008..e37ab0ed3 100644 --- a/pytential/qbx/cost.py +++ b/pytential/qbx/cost.py @@ -654,7 +654,7 @@ def get_kernel(): nqbx_centers += global_qbx_center_weight[iparticle]; nqbx_centers_itgt_box[i] = nqbx_centers; - """).render( # noqa: E501 + """).render( # ruff:ignore[line-too-long] box_id_t=dtype_to_ctype(box_id_dtype), particle_id_t=dtype_to_ctype(particle_id_dtype) ), diff --git a/pytential/qbx/geometry.py b/pytential/qbx/geometry.py index 08491d046..7578b9aca 100644 --- a/pytential/qbx/geometry.py +++ b/pytential/qbx/geometry.py @@ -99,7 +99,7 @@ # {{{ code getter -class target_state(Enum): # noqa +class target_state(Enum): # ruff:ignore[invalid-class-name] """This enumeration contains special values that are used in the array returned by :meth:`QBXFMMGeometryData.user_target_to_center`. diff --git a/pytential/qbx/target_assoc.py b/pytential/qbx/target_assoc.py index 17949ed5e..0bb651e63 100644 --- a/pytential/qbx/target_assoc.py +++ b/pytential/qbx/target_assoc.py @@ -150,7 +150,7 @@ # {{{ kernels -class target_status_enum(Enum): # noqa +class target_status_enum(Enum): # ruff:ignore[invalid-class-name] c_name = "TargetStatus" dtype = np.dtype(np.int32) c_value_prefix = "" @@ -160,7 +160,7 @@ class target_status_enum(Enum): # noqa MARKED_QBX_CENTER_FOUND = 2 -class target_flag_enum(Enum): # noqa +class target_flag_enum(Enum): # ruff:ignore[invalid-class-name] c_name = "TargetFlag" dtype = np.dtype(np.int32) c_value_prefix = "" diff --git a/pytential/qbx/target_specific/__init__.py b/pytential/qbx/target_specific/__init__.py index bc020cabb..b787fb489 100644 --- a/pytential/qbx/target_specific/__init__.py +++ b/pytential/qbx/target_specific/__init__.py @@ -24,4 +24,4 @@ """ -from .impl import * # noqa +from .impl import * # ruff:ignore[undefined-local-with-import-star] diff --git a/pytential/qbx/utils.py b/pytential/qbx/utils.py index 4486d15ce..8a80e6004 100644 --- a/pytential/qbx/utils.py +++ b/pytential/qbx/utils.py @@ -31,7 +31,10 @@ import numpy as np -from arraycontext import Array, PyOpenCLArrayContext # noqa: TC001 +from arraycontext import ( # ruff:ignore[typing-only-first-party-import] + Array, + PyOpenCLArrayContext, +) from boxtree.array_context import dataclass_array_container from boxtree.pyfmmlib_integration import FMMLibRotationDataInterface from boxtree.tree import Tree diff --git a/pytential/solve.py b/pytential/solve.py index 146815a12..33913e20c 100644 --- a/pytential/solve.py +++ b/pytential/solve.py @@ -2,7 +2,7 @@ from warnings import warn -from pytential.linalg.gmres import * # noqa: F403 +from pytential.linalg.gmres import * # ruff:ignore[undefined-local-with-import-star] warn( diff --git a/pytential/symbolic/dof_connection.py b/pytential/symbolic/dof_connection.py index 8c03823df..0393f6f7b 100644 --- a/pytential/symbolic/dof_connection.py +++ b/pytential/symbolic/dof_connection.py @@ -28,7 +28,7 @@ from typing import TYPE_CHECKING -import numpy as np # noqa: F401 +import numpy as np # ruff:ignore[unused-import] from typing_extensions import override import loopy as lp diff --git a/pytential/symbolic/dof_desc.py b/pytential/symbolic/dof_desc.py index 70541a743..cbf4d639b 100644 --- a/pytential/symbolic/dof_desc.py +++ b/pytential/symbolic/dof_desc.py @@ -53,41 +53,41 @@ # {{{ discretizations -class _UNNAMED_SOURCE: # noqa: N801 +class _UNNAMED_SOURCE: # ruff:ignore[invalid-class-name] """Symbolic identifier for an unnamed source. This is for internal use only.""" -class _UNNAMED_TARGET: # noqa: N801 +class _UNNAMED_TARGET: # ruff:ignore[invalid-class-name] """Symbolic identifier for an unnamed target. This is for internal use only.""" -class DEFAULT_SOURCE: # noqa: N801 +class DEFAULT_SOURCE: # ruff:ignore[invalid-class-name] """Symbolic identifier for the default source. Geometries with this value get replaced with the default source given to :func:`pytential.bind`.""" -class DEFAULT_TARGET: # noqa: N801 +class DEFAULT_TARGET: # ruff:ignore[invalid-class-name] """Symbolic identifier for the default target. Geometries with this value get replaced with the default target given to :func:`pytential.bind`.""" -class QBX_SOURCE_STAGE1: # noqa: N801 +class QBX_SOURCE_STAGE1: # ruff:ignore[invalid-class-name] """Symbolic identifier for the Stage 1 discretization of a :class:`pytential.qbx.QBXLayerPotentialSource`. """ -class QBX_SOURCE_STAGE2: # noqa: N801 +class QBX_SOURCE_STAGE2: # ruff:ignore[invalid-class-name] """Symbolic identifier for the Stage 2 discretization of a :class:`pytential.qbx.QBXLayerPotentialSource`. """ -class QBX_SOURCE_QUAD_STAGE2: # noqa: N801 +class QBX_SOURCE_QUAD_STAGE2: # ruff:ignore[invalid-class-name] """Symbolic identifier for the upsampled Stage 2 discretization of a :class:`pytential.qbx.QBXLayerPotentialSource`. """ @@ -98,15 +98,15 @@ class QBX_SOURCE_QUAD_STAGE2: # noqa: N801 # {{{ granularity -class GRANULARITY_NODE: # noqa: N801 +class GRANULARITY_NODE: # ruff:ignore[invalid-class-name] """DOFs are per node.""" -class GRANULARITY_CENTER: # noqa: N801 +class GRANULARITY_CENTER: # ruff:ignore[invalid-class-name] """DOFs interleaved per expansion center (two per node, one on each side).""" -class GRANULARITY_ELEMENT: # noqa: N801 +class GRANULARITY_ELEMENT: # ruff:ignore[invalid-class-name] """DOFs per discretization element.""" diff --git a/pytential/symbolic/mappers.py b/pytential/symbolic/mappers.py index d437b9113..5713740be 100644 --- a/pytential/symbolic/mappers.py +++ b/pytential/symbolic/mappers.py @@ -38,7 +38,7 @@ Collector as CollectorBase, CombineMapper as CombineMapperBase, DerivativeBinder as DerivativeBinderBase, - DerivativeSourceAndNablaComponentCollector as DerivativeSourceAndNablaComponentCollectorBase, # noqa: E501 + DerivativeSourceAndNablaComponentCollector as DerivativeSourceAndNablaComponentCollectorBase, # ruff:ignore[line-too-long] DerivativeSourceFinder as DerivativeSourceFinderBase, EvaluationRewriter as EvaluationRewriterBase, GraphvizMapper as GraphvizMapperBase, @@ -281,11 +281,11 @@ def _map_leaf(self, return set() map_ones: Callable[[Self, pp.Ones], AbstractSet[CollectedT]] = _map_leaf - map_is_shape_class: Callable[[Self, pp.IsShapeClass], AbstractSet[CollectedT]] = _map_leaf # noqa: E501 - map_error_expression: Callable[[Self, pp.ErrorExpression], AbstractSet[CollectedT]] = _map_leaf # noqa: E501 - map_node_coordinate_component: Callable[[Self, pp.NodeCoordinateComponent], AbstractSet[CollectedT]] = _map_leaf # noqa: E501 + map_is_shape_class: Callable[[Self, pp.IsShapeClass], AbstractSet[CollectedT]] = _map_leaf # ruff:ignore[line-too-long] + map_error_expression: Callable[[Self, pp.ErrorExpression], AbstractSet[CollectedT]] = _map_leaf # ruff:ignore[line-too-long] + map_node_coordinate_component: Callable[[Self, pp.NodeCoordinateComponent], AbstractSet[CollectedT]] = _map_leaf # ruff:ignore[line-too-long] map_q_weight: Callable[[Self, pp.QWeight], AbstractSet[CollectedT]] = _map_leaf - map_spatial_constant: Callable[[Self, pp.SpatialConstant], AbstractSet[CollectedT]] = _map_leaf # noqa: E501 + map_spatial_constant: Callable[[Self, pp.SpatialConstant], AbstractSet[CollectedT]] = _map_leaf # ruff:ignore[line-too-long] class OperatorCollector(Collector[pp.IntG]): diff --git a/pytential/symbolic/pde/cahn_hilliard.py b/pytential/symbolic/pde/cahn_hilliard.py index a14c2fcbf..11f240564 100644 --- a/pytential/symbolic/pde/cahn_hilliard.py +++ b/pytential/symbolic/pde/cahn_hilliard.py @@ -46,7 +46,7 @@ def make_unknown(self, name): def S_G(self, i, density, qbx_forced_limit, op_map=None): if op_map is None: - op_map = lambda x: x # noqa: E731 + op_map = lambda x: x # ruff:ignore[lambda-assignment] from sumpy.kernel import HelmholtzKernel hhk = HelmholtzKernel(2, allow_evanescent=True) diff --git a/pytential/symbolic/primitives.py b/pytential/symbolic/primitives.py index b46006510..02e075ea6 100644 --- a/pytential/symbolic/primitives.py +++ b/pytential/symbolic/primitives.py @@ -50,7 +50,7 @@ Nabla, NablaComponent, ) -from pymbolic.primitives import ( # noqa: N813 +from pymbolic.primitives import ( # ruff:ignore[camelcase-imported-as-lowercase] Variable as var, cse_scope as cse_scope_base, expr_dataclass, @@ -370,7 +370,7 @@ .. autofunction:: pretty """ -__all__ = ( # noqa: RUF022 +__all__ = ( # ruff:ignore[unsorted-dunder-all] # re-export from pymbolic "Variable", "cse", @@ -481,7 +481,7 @@ def make_stringifier( | tuple[tuple[str, Operand], ...]) -class cse_scope(cse_scope_base): # noqa: N801 +class cse_scope(cse_scope_base): # ruff:ignore[invalid-class-name] DISCRETIZATION: ClassVar[str] = "pytential_discretization" @@ -2188,7 +2188,7 @@ def add_dir_vector_to_kernel_arguments(coeff: ArithmeticExpression) -> Operand: # {{{ geometric calculus -class _unspecified: # noqa: N801 +class _unspecified: # ruff:ignore[invalid-class-name] pass diff --git a/test/test_beltrami.py b/test/test_beltrami.py index 7bfd9c8c0..225a69016 100644 --- a/test/test_beltrami.py +++ b/test/test_beltrami.py @@ -39,7 +39,9 @@ LaplaceBeltramiOperator, YukawaBeltramiOperator, ) -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) if TYPE_CHECKING: @@ -303,7 +305,7 @@ def test_beltrami_convergence( if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_cost_model.py b/test/test_cost_model.py index 958e10940..9e6255e35 100644 --- a/test/test_cost_model.py +++ b/test/test_cost_model.py @@ -44,7 +44,9 @@ _PythonQBXCostModel, make_pde_aware_translation_cost_model, ) -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -849,7 +851,7 @@ def level_to_order_varying(kernel, kernel_args, tree, level): import os import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] logging.basicConfig(level=os.environ.get("LOGLEVEL", "WARNING")) if len(sys.argv) > 1: diff --git a/test/test_global_qbx.py b/test/test_global_qbx.py index 50a10ca86..7746de951 100644 --- a/test/test_global_qbx.py +++ b/test/test_global_qbx.py @@ -46,7 +46,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory from pytential.qbx import QBXLayerPotentialSource -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -570,7 +572,7 @@ def test_target_association_failure(actx_factory: ArrayContextFactory): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_layer_pot.py b/test/test_layer_pot.py index 6d6120979..3c7053743 100644 --- a/test/test_layer_pot.py +++ b/test/test_layer_pot.py @@ -39,7 +39,9 @@ from pytential import GeometryCollection, bind, norm, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -631,7 +633,7 @@ def nxcurlS(knl, density_sym, qbx_forced_limit): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_layer_pot_eigenvalues.py b/test/test_layer_pot_eigenvalues.py index 5841f4291..e1a921f71 100644 --- a/test/test_layer_pot_eigenvalues.py +++ b/test/test_layer_pot_eigenvalues.py @@ -34,7 +34,9 @@ from pytential import GeometryCollection, bind, norm, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -398,7 +400,7 @@ def rel_err(comp, ref): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_layer_pot_identity.py b/test/test_layer_pot_identity.py index fe3eb8942..e7b533c93 100644 --- a/test/test_layer_pot_identity.py +++ b/test/test_layer_pot_identity.py @@ -46,7 +46,9 @@ from pytential import GeometryCollection, bind, norm, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) if TYPE_CHECKING: @@ -419,7 +421,7 @@ def test_identity_convergence(actx_factory: ArrayContextFactory, if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_linalg_proxy.py b/test/test_linalg_proxy.py index a001469d2..bf1866540 100644 --- a/test/test_linalg_proxy.py +++ b/test/test_linalg_proxy.py @@ -42,7 +42,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory from pytential.linalg.proxy import ProxyGenerator, QBXProxyGenerator -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -380,7 +382,7 @@ def test_neighbor_points(actx_factory: ArrayContextFactory, case, if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_linalg_skeletonization.py b/test/test_linalg_skeletonization.py index 9a51f74df..ec742f9e8 100644 --- a/test/test_linalg_skeletonization.py +++ b/test/test_linalg_skeletonization.py @@ -38,7 +38,9 @@ from pytential import GeometryCollection, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) if TYPE_CHECKING: @@ -505,7 +507,7 @@ def test_skeletonize_by_proxy_convergence( if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_linalg_utils.py b/test/test_linalg_utils.py index 700056364..cb5befc9e 100644 --- a/test/test_linalg_utils.py +++ b/test/test_linalg_utils.py @@ -32,7 +32,9 @@ from arraycontext import ArrayContextFactory, pytest_generate_tests_for_array_contexts from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -92,7 +94,7 @@ def test_matrix_cluster_index(actx_factory: ArrayContextFactory): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_matrix.py b/test/test_matrix.py index 5d9001e7d..dcafada72 100644 --- a/test/test_matrix.py +++ b/test/test_matrix.py @@ -45,7 +45,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -536,7 +538,7 @@ def test_build_matrix_fixed_stage( if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_maxwell.py b/test/test_maxwell.py index a9f89d0ab..809f1068c 100644 --- a/test/test_maxwell.py +++ b/test/test_maxwell.py @@ -396,8 +396,8 @@ def eval_repr_at(tgt, source=None, target=None): source = "source" return bind( - places, sym_repr, auto_where=(source, target) # noqa: B023 - )(actx, jt=jt, rho=rho, **knl_kwargs) # noqa: B023 + places, sym_repr, auto_where=(source, target) # ruff:ignore[function-uses-loop-variable] + )(actx, jt=jt, rho=rho, **knl_kwargs) # ruff:ignore[function-uses-loop-variable] pde_test_repr = EHField( actx.from_numpy(eval_repr_at(places, target="patch_target")) @@ -539,7 +539,7 @@ def eval_repr_at(tgt, source=None, target=None): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_scalar_int_eq.py b/test/test_scalar_int_eq.py index 74dabe2ee..fee29641a 100644 --- a/test/test_scalar_int_eq.py +++ b/test/test_scalar_int_eq.py @@ -41,7 +41,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -472,7 +474,7 @@ def run_int_eq_test(actx, # Sample test run: -# 'test_integral_equation(cl._csc, EllipseIntEqTestCase(LaplaceKernel, "dirichlet", +1), visualize=True)' # noqa: E501 +# 'test_integral_equation(cl._csc, EllipseIntEqTestCase(LaplaceKernel, "dirichlet", +1), visualize=True)' # ruff:ignore[line-too-long] @pytest.mark.parametrize("case", cases) def test_integral_equation(actx_factory: ArrayContextFactory, case, visualize=False): @@ -525,7 +527,7 @@ def test_integral_equation(actx_factory: ArrayContextFactory, case, visualize=Fa if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_stokes.py b/test/test_stokes.py index a5e7f2a89..d8e4d8320 100644 --- a/test/test_stokes.py +++ b/test/test_stokes.py @@ -41,7 +41,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -535,7 +537,7 @@ def test_stresslet_identity( if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_symbolic.py b/test/test_symbolic.py index f1ba0c040..7b43d7814 100644 --- a/test/test_symbolic.py +++ b/test/test_symbolic.py @@ -45,7 +45,9 @@ from pytential import bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) if TYPE_CHECKING: @@ -607,7 +609,7 @@ def test_derivative_with_spatial_constant(): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_target_specific_qbx.py b/test/test_target_specific_qbx.py index ad575610f..b20429f00 100644 --- a/test/test_target_specific_qbx.py +++ b/test/test_target_specific_qbx.py @@ -33,7 +33,9 @@ from pytential import GeometryCollection, bind, sym from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -218,7 +220,7 @@ def test_target_specific_qbx(actx_factory, op, helmholtz_k, qbx_order): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1]) diff --git a/test/test_tools.py b/test/test_tools.py index b5c886ffe..bbe85ce0e 100644 --- a/test/test_tools.py +++ b/test/test_tools.py @@ -33,7 +33,9 @@ from arraycontext import ArrayContextFactory, pytest_generate_tests_for_array_contexts from pytential.array_context import PytestPyOpenCLArrayContextFactory -from pytential.utils import pytest_teardown_function as teardown_function # noqa: F401 +from pytential.utils import ( + pytest_teardown_function as teardown_function, # ruff:ignore[unused-import] +) logger = logging.getLogger(__name__) @@ -55,7 +57,7 @@ def test_gmres(): true_sol = rng.normal(size=n) + 1j * rng.normal(size=n) b = np.dot(A, true_sol) - A_func = lambda x: np.dot(A, x) # noqa + A_func = lambda x: np.dot(A, x) # ruff:ignore[lambda-assignment] A_func.shape = A.shape A_func.dtype = A.dtype @@ -292,7 +294,7 @@ def test_add_geometry_to_collection(actx_factory: ArrayContextFactory): if __name__ == "__main__": import sys - from pytential.array_context import _acf # noqa: F401 + from pytential.array_context import _acf # ruff:ignore[unused-import] if len(sys.argv) > 1: exec(sys.argv[1])