Skip to content

Commit 7b7e9f8

Browse files
committed
Fix instances of RUF052,RUF051
1 parent f2ed9db commit 7b7e9f8

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

loopy/schedule/tree.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ def add_node(self, node: NodeT, parent: NodeT) -> Tree[NodeT]:
149149

150150
siblings = self._parent_to_children[parent]
151151

152-
_parent_to_children_mut = self._parent_to_children.mutate()
153-
_parent_to_children_mut[parent] = (*siblings, node)
154-
_parent_to_children_mut[node] = ()
152+
parent_to_children_mut = self._parent_to_children.mutate()
153+
parent_to_children_mut[parent] = (*siblings, node)
154+
parent_to_children_mut[node] = ()
155155

156-
return Tree(_parent_to_children_mut.finish(),
156+
return Tree(parent_to_children_mut.finish(),
157157
self._child_to_parent.set(node, parent))
158158

159159
def replace_node(self, node: NodeT, new_node: NodeT) -> Tree[NodeT]:
@@ -223,11 +223,11 @@ def move_node(self, node: NodeT, new_parent: NodeT | None) -> Tree[NodeT]:
223223
parents_new_children = tuple(frozenset(siblings) - frozenset([node]))
224224
new_parents_children = (*self.children(new_parent), node)
225225

226-
_parent_to_children_mut = self._parent_to_children.mutate()
227-
_parent_to_children_mut[parent] = parents_new_children
228-
_parent_to_children_mut[new_parent] = new_parents_children
226+
parent_to_children_mut = self._parent_to_children.mutate()
227+
parent_to_children_mut[parent] = parents_new_children
228+
parent_to_children_mut[new_parent] = new_parents_children
229229

230-
return Tree(_parent_to_children_mut.finish(),
230+
return Tree(parent_to_children_mut.finish(),
231231
self._child_to_parent.set(node, new_parent))
232232

233233
def __str__(self) -> str:

loopy/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@ def empty_aligned(shape, dtype, order="C", n=64):
305305

306306
# We now need to know how to offset base_ary
307307
# so it is correctly aligned
308-
_array_aligned_offset = (n-address_from_numpy(base_ary)) % n
308+
array_aligned_offset = (n-address_from_numpy(base_ary)) % n
309309

310310
array = np.frombuffer(
311-
base_ary[_array_aligned_offset:_array_aligned_offset-n].data,
311+
base_ary[array_aligned_offset:array_aligned_offset-n].data,
312312
dtype=dtype).reshape(shape, order=order)
313313

314314
return array

loopy/transform/precompute.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,7 @@ def precompute_for_single_kernel(
772772
if abm.non1_storage_axis_flags[i]:
773773
non1_storage_axis_names.append(saxis)
774774
else:
775-
if saxis in new_iname_to_tag:
776-
del new_iname_to_tag[saxis]
775+
new_iname_to_tag.pop(saxis, None)
777776

778777
if saxis in preexisting_precompute_inames:
779778
raise LoopyError("precompute axis %d (1-based) was "

0 commit comments

Comments
 (0)