Skip to content

Commit

Permalink
Fix legitimate instances of RUF052
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Dec 10, 2024
1 parent dcf49c4 commit cef8b50
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions pytato/distributed/partition.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,18 +992,18 @@ def get_materialized_predecessors(ary: Array) -> _OrderedSet[Array]:

# }}}

# Don't be tempted to put outputs in _array_names; the mapping from output array
# Don't be tempted to put outputs in array_names; the mapping from output array
# to name may not be unique
_array_name_gen = UniqueNameGenerator(forced_prefix="_pt_dist_")
_array_names: dict[Array, str] = {}
array_name_gen = UniqueNameGenerator(forced_prefix="_pt_dist_")
array_names: dict[Array, str] = {}

def gen_array_name(ary: Array) -> str:
name = _array_names.get(ary)
name = array_names.get(ary)
if name is not None:
return name
else:
name = _array_name_gen()
_array_names[ary] = name
name = array_name_gen()
array_names[ary] = name
return name

recvd_ary_to_name: dict[Array, str] = {
Expand Down
10 changes: 5 additions & 5 deletions test/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1571,11 +1571,11 @@ def test_regression_reduction_in_conditional(ctx_factory):
cq = cl.CommandQueue(ctx)

def kernel(usr_np, _pt_data_9):
_pt_tmp_53 = _pt_data_9 @ _pt_data_9
_pt_tmp_42 = usr_np.maximum(_pt_tmp_53, _pt_tmp_53)
_pt_tmp_27 = usr_np.sum(_pt_tmp_42)
_pt_tmp_0 = usr_np.maximum(_pt_tmp_27, _pt_tmp_53)
return _pt_tmp_0
pt_tmp_53 = _pt_data_9 @ _pt_data_9
pt_tmp_42 = usr_np.maximum(pt_tmp_53, pt_tmp_53)
pt_tmp_27 = usr_np.sum(pt_tmp_42)
pt_tmp_0 = usr_np.maximum(pt_tmp_27, pt_tmp_53)
return pt_tmp_0

def get_np_input_args():
return {
Expand Down

0 comments on commit cef8b50

Please sign in to comment.