Skip to content

Commit e052c5c

Browse files
committed
Switch to ruff:ignore
1 parent 37597d7 commit e052c5c

14 files changed

Lines changed: 40 additions & 35 deletions

File tree

arraycontext/container/arithmetic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
from pytools.obj_array import (
5656
ObjectArray,
5757
# for backward compatibility
58-
ObjectArray as NumpyObjectArray, # noqa: F401 # pyright: ignore[reportUnusedImport]
58+
ObjectArray as NumpyObjectArray, # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
5959
)
6060

6161
from arraycontext.container import (
@@ -740,7 +740,7 @@ def {fname}(arg2, arg1):
740740
code = gen.get().rstrip()+"\n"
741741

742742
result_dict = {"_MODULE_SOURCE_CODE": code, "cls": cls}
743-
exec(compile(code, f"<container arithmetic for {cls.__name__}>", "exec"), # noqa: S102
743+
exec(compile(code, f"<container arithmetic for {cls.__name__}>", "exec"), # ruff:ignore[exec-builtin]
744744
result_dict)
745745

746746
return cls

arraycontext/container/dataclass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def _deserialize_init_arrays_code_{lower_cls_name}(
247247
""")
248248

249249
exec_dict = {"cls": cls, "_MODULE_SOURCE_CODE": serialize_code}
250-
exec(compile(serialize_code, f"<container serialization for {cls.__name__}>", # noqa: S102
250+
exec(compile(serialize_code, f"<container serialization for {cls.__name__}>", # ruff:ignore[exec-builtin]
251251
"exec"), exec_dict)
252252

253253
return cls

arraycontext/container/traversal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def rec(*args_: Any) -> Any:
242242
except NotAnArrayContainerError:
243243
return f(*args_)
244244

245-
if __debug__: # noqa: SIM102
245+
if __debug__: # ruff:ignore[collapsible-if]
246246
if not all(
247247
type(args_[i]) is type(template_ary)
248248
for i in container_indices[1:]
@@ -1039,7 +1039,7 @@ def _unflatten(
10391039

10401040
# {{{ check strides
10411041

1042-
if strict and hasattr(template_subary_c, "strides"): # noqa: SIM102
1042+
if strict and hasattr(template_subary_c, "strides"): # ruff:ignore[collapsible-if]
10431043
# Checking strides for 0 sized arrays is ill-defined
10441044
# since they cannot be indexed
10451045
if (

arraycontext/impl/pytato/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def _preprocess_array_tags(tags: ToTagSetConvertible) -> frozenset[Tag]:
135135
# }}}
136136

137137

138-
class _NotOnlyDataWrappers(Exception): # noqa: N818
138+
class _NotOnlyDataWrappers(Exception): # ruff:ignore[error-suffix-on-exception-name]
139139
pass
140140

141141

@@ -858,7 +858,7 @@ def preprocess_arg(name, arg):
858858
f"array type: got '{type(arg).__name__}', but expected one "
859859
f"of {self.array_types}")
860860

861-
if name is not None: # noqa: SIM102
861+
if name is not None: # ruff:ignore[collapsible-if]
862862
# Tagging Placeholders with naming-related tags is pointless:
863863
# They already have names. It's also counterproductive, as
864864
# multiple placeholders with the same name that are not
@@ -1122,7 +1122,7 @@ def preprocess_arg(name: str | None, arg: Array):
11221122
f"array type: got '{type(arg).__name__}', but expected one "
11231123
f"of {self.array_types}")
11241124

1125-
if name is not None: # noqa: SIM102
1125+
if name is not None: # ruff:ignore[collapsible-if]
11261126
# Tagging Placeholders with naming-related tags is pointless:
11271127
# They already have names. It's also counterproductive, as
11281128
# multiple placeholders with the same name that are not

arraycontext/impl/pytato/compile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def _get_arg_id_to_arg_and_arg_id_to_descr(args: tuple[Any, ...],
150150
arg_id_to_descr[arg_id] = ScalarInputDescriptor(np.dtype(type(arg)))
151151
elif is_array_container_type(arg.__class__):
152152
def id_collector(keys, ary):
153-
arg_id = (kw, *keys) # noqa: B023
153+
arg_id = (kw, *keys) # ruff:ignore[function-uses-loop-variable]
154154
arg_id_to_arg[arg_id] = ary
155155
arg_id_to_descr[arg_id] = LeafArrayDescriptor(
156156
np.dtype(ary.dtype), ary.shape)

arraycontext/impl/pytato/outline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def id_collector(
8787
pass
8888
else:
8989
assert isinstance(ary, pt.Array)
90-
arg_id = (kw, *keys) # noqa: B023
90+
arg_id = (kw, *keys) # ruff:ignore[function-uses-loop-variable]
9191
arg_id_to_arg[arg_id] = ary
9292
return ary
9393

arraycontext/pytest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self, device: cl.Device) -> None:
7878
@override
7979
def is_available(cls) -> bool:
8080
try:
81-
import pyopencl # noqa: F401 # pyright: ignore[reportUnusedImport]
81+
import pyopencl # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
8282
except ImportError:
8383
return False
8484
else:
@@ -154,8 +154,8 @@ class _PytestPytatoPyOpenCLArrayContextFactory(PytestPyOpenCLArrayContextFactory
154154
@override
155155
def is_available(cls) -> bool:
156156
try:
157-
import pyopencl # noqa: F401 # pyright: ignore[reportUnusedImport]
158-
import pytato # noqa: F401 # pyright: ignore[reportUnusedImport]
157+
import pyopencl # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
158+
import pytato # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
159159
except ImportError:
160160
return False
161161
else:
@@ -204,7 +204,7 @@ def __init__(self, *args, **kwargs) -> None:
204204
@override
205205
def is_available(cls) -> bool:
206206
try:
207-
import jax # noqa: F401 # pyright: ignore[reportUnusedImport]
207+
import jax # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
208208
except ImportError:
209209
return False
210210
else:
@@ -232,8 +232,8 @@ def __init__(self, *args, **kwargs) -> None:
232232
@override
233233
def is_available(cls) -> bool:
234234
try:
235-
import jax # noqa: F401 # pyright: ignore[reportUnusedImport]
236-
import pytato # noqa: F401 # pyright: ignore[reportUnusedImport]
235+
import jax # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
236+
import pytato # ruff:ignore[unused-import] # pyright: ignore[reportUnusedImport]
237237
except ImportError:
238238
return False
239239
else:

arraycontext/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def reshape(self, *shape: int, order: OrderCF = "C") -> Array: ...
190190
def reshape(self, shape: tuple[int, ...], /, *, order: OrderCF = "C") -> Array: ...
191191

192192
@property
193-
def T(self) -> Array: ... # noqa: N802
193+
def T(self) -> Array: ... # ruff:ignore[invalid-function-name]
194194

195195
def transpose(self, axes: tuple[int, ...]) -> Array: ...
196196

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@
5555

5656

5757
def setup(app):
58-
app.connect("missing-reference", process_autodoc_missing_reference) # noqa: F821
58+
app.connect("missing-reference", process_autodoc_missing_reference) # ruff:ignore[undefined-name]

examples/stub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
import arraycontext # noqa
1+
import arraycontext # ruff:ignore[unused-import, missing-required-import]

0 commit comments

Comments
 (0)