Skip to content

Commit 4c59775

Browse files
committed
Fix: ruff check
1 parent 9cc0448 commit 4c59775

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

machine_learning/frequent_pattern_growth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def ascend_tree(leaf_node: TreeNode, prefix_path: list[str]) -> None:
240240
ascend_tree(leaf_node.parent, prefix_path)
241241

242242

243-
def find_prefix_path(base_pat: frozenset, tree_node: TreeNode | None) -> dict:
243+
def find_prefix_path(_base_pat: frozenset, tree_node: TreeNode | None) -> dict:
244244
"""
245245
Find the conditional pattern base for a given base pattern.
246246

sorts/bead_sort.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Bead sort only works for sequences of non-negative integers.
33
https://en.wikipedia.org/wiki/Bead_sort
44
"""
5-
5+
from itertools import pairwise
66

77
def bead_sort(sequence: list) -> list:
88
"""
@@ -31,7 +31,7 @@ def bead_sort(sequence: list) -> list:
3131
if any(not isinstance(x, int) or x < 0 for x in sequence):
3232
raise TypeError("Sequence must be list of non-negative integers")
3333
for _ in range(len(sequence)):
34-
for i, (rod_upper, rod_lower) in enumerate(zip(sequence, sequence[1:])):
34+
for i, (rod_upper, rod_lower) in enumerate(pairwise(sequence)):
3535
if rod_upper > rod_lower:
3636
sequence[i] -= rod_upper - rod_lower
3737
sequence[i + 1] += rod_upper - rod_lower

strings/min_cost_string_conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def assemble_transformation(ops: list[list[str]], i: int, j: int) -> list[str]:
140140
elif op[0] == "R":
141141
string[i] = op[2]
142142

143-
file.write("%-16s" % ("Replace %c" % op[1] + " with " + str(op[2])))
143+
file.write(f"{'Replace ' + op[1] + ' with ' + str(op[2]):<16}")
144144
file.write("\t\t" + "".join(string))
145145
file.write("\r\n")
146146

0 commit comments

Comments
 (0)