Skip to content

Commit 7714527

Browse files
committed
Update config, fix lints for ruff 0.15.2
1 parent cdbb9cb commit 7714527

File tree

12 files changed

+16
-25
lines changed

12 files changed

+16
-25
lines changed

arraycontext/container/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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"),
743+
exec(compile(code, f"<container arithmetic for {cls.__name__}>", "exec"), # noqa: S102
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__}>",
250+
exec(compile(serialize_code, f"<container serialization for {cls.__name__}>", # noqa: S102
251251
"exec"), exec_dict)
252252

253253
return cls

arraycontext/context.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,6 @@
129129

130130
from pytools import memoize_method
131131

132-
# FIXME: remove sometime, this import was used in grudge in July 2025.
133-
from .typing import ArrayOrArithContainerTc as ArrayOrArithContainerTc
134-
135132

136133
if TYPE_CHECKING:
137134
import numpy as np

arraycontext/impl/pyopencl/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,7 @@ def transform_loopy_program(self, t_unit: lp.TranslationUnit) -> lp.TranslationU
389389

390390
if inner_iname is not None:
391391
t_unit = lp.split_iname(t_unit, inner_iname, 16, inner_tag="l.0")
392-
t_unit = lp.tag_inames(t_unit, {outer_iname: "g.0"})
393-
394-
return t_unit
392+
return lp.tag_inames(t_unit, {outer_iname: "g.0"})
395393

396394
# }}}
397395

arraycontext/impl/pyopencl/taggable_cl_array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def empty(
188188
dtype: DTypeLike | None = None,
189189
*, axes: tuple[Axis, ...] | None = None,
190190
tags: frozenset[Tag] = _EMPTY_TAG_SET,
191-
order: Literal["C"] | Literal["F"] = "C",
191+
order: Literal["C", "F"] = "C",
192192
allocator: cla.Allocator | None = None,
193193
) -> TaggableCLArray:
194194
if dtype is not None:
@@ -206,7 +206,7 @@ def zeros(
206206
dtype: DTypeLike = float,
207207
*, axes: tuple[Axis, ...] | None = None,
208208
tags: frozenset[Tag] = _EMPTY_TAG_SET,
209-
order: Literal["C"] | Literal["F"] = "C",
209+
order: Literal["C", "F"] = "C",
210210
allocator: cla.Allocator | None = None,
211211
) -> TaggableCLArray:
212212
result = empty(

arraycontext/impl/pytato/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,8 +830,7 @@ def transform_dag(self, dag: pytato.AbstractResultWithNamedArrays
830830
import pytato as pt
831831
dag = pt.tag_all_calls_to_be_inlined(dag)
832832
dag = pt.inline_calls(dag)
833-
dag = pt.transform.materialize_with_mpms(dag)
834-
return dag
833+
return pt.transform.materialize_with_mpms(dag)
835834

836835
def einsum(self, spec, *args, arg_names=None, tagged=()):
837836
import pytato as pt
@@ -1047,8 +1046,7 @@ def transform_dag(self, dag: pytato.AbstractResultWithNamedArrays
10471046
) -> pytato.AbstractResultWithNamedArrays:
10481047
import pytato as pt
10491048
dag = pt.tag_all_calls_to_be_inlined(dag)
1050-
dag = pt.inline_calls(dag)
1051-
return dag
1049+
return pt.inline_calls(dag)
10521050

10531051
@override
10541052
def tag(self,

arraycontext/impl/pytato/compile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ class BaseLazilyCompilingFunctionCaller:
265265
actx: _BasePytatoArrayContext
266266
f: Callable[..., Any]
267267
program_cache: dict[Mapping[tuple[Hashable, ...], AbstractInputDescriptor],
268-
CompiledFunction] = field(default_factory=lambda: {})
268+
CompiledFunction] = field(default_factory=dict)
269269

270270
# {{{ abstract interface
271271

@@ -610,7 +610,6 @@ def __call__(self, arg_id_to_arg) -> Any:
610610
:attr:`CompiledFunction.input_id_to_name_in_program` for input id's
611611
representation.
612612
"""
613-
pass
614613

615614
# }}}
616615

arraycontext/impl/pytato/fake_numpy.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def _full_like_array(self,
112112
ary: Array,
113113
fill_value: Scalar,
114114
) -> Array:
115-
...
116115
ary = cast("pt.Array", ary)
117116
return pt.full(ary.shape, fill_value, ary.dtype).copy(
118117
axes=ary.axes, tags=ary.tags)

arraycontext/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117

118118
# We won't support 'A' and 'K', since they depend on in-memory order; that is
119119
# not intended to be a meaningful concept for actx arrays.
120-
OrderCF: TypeAlias = Literal["C"] | Literal["F"]
120+
OrderCF: TypeAlias = Literal["C", "F"]
121121

122122

123123
class Array(Protocol):

examples/how_to_outline.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing_extensions import override
88

99
import pytato as pt
10-
import pytools.obj_array as obj_array
10+
from pytools import obj_array
1111

1212
from arraycontext import (
1313
Array,
@@ -52,9 +52,7 @@ def transform_dag(self,
5252
# dag = pt.inline_calls(dag)
5353
# print("[Post-concatenation] Number of nodes =",
5454
# pt.analysis.get_num_nodes(dag))
55-
dag = pt.inline_calls(dag)
56-
57-
return dag
55+
return pt.inline_calls(dag)
5856

5957

6058
actx = PytatoJAXArrayContext()

0 commit comments

Comments
 (0)