mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
Enable ruff RUF005 rule (#11344)
This commit is contained in:
parent
f437f92279
commit
f5bbea3776
|
@ -336,7 +336,7 @@ def inorder(curr_node: Node | None) -> list[Node]:
|
||||||
"""
|
"""
|
||||||
node_list = []
|
node_list = []
|
||||||
if curr_node is not None:
|
if curr_node is not None:
|
||||||
node_list = inorder(curr_node.left) + [curr_node] + inorder(curr_node.right)
|
node_list = [*inorder(curr_node.left), curr_node, *inorder(curr_node.right)]
|
||||||
return node_list
|
return node_list
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ def subset_combinations(elements: list[int], n: int) -> list:
|
||||||
for i in range(1, r + 1):
|
for i in range(1, r + 1):
|
||||||
for j in range(i, 0, -1):
|
for j in range(i, 0, -1):
|
||||||
for prev_combination in dp[j - 1]:
|
for prev_combination in dp[j - 1]:
|
||||||
dp[j].append(tuple(prev_combination) + (elements[i - 1],))
|
dp[j].append((*prev_combination, elements[i - 1]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return sorted(dp[n])
|
return sorted(dp[n])
|
||||||
|
|
|
@ -33,7 +33,7 @@ def odd_sieve(num: int) -> list[int]:
|
||||||
0, ceil((num - i_squared) / (i << 1))
|
0, ceil((num - i_squared) / (i << 1))
|
||||||
)
|
)
|
||||||
|
|
||||||
return [2] + list(compress(range(3, num, 2), sieve))
|
return [2, *list(compress(range(3, num, 2), sieve))]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -12,7 +12,10 @@ lint.ignore = [ # `ruff rule S101` for a description of that rule
|
||||||
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
|
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
|
||||||
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
|
"PT011", # `pytest.raises(Exception)` is too broad, set the `match` parameter or use a more specific exception
|
||||||
"PT018", # Assertion should be broken down into multiple parts
|
"PT018", # Assertion should be broken down into multiple parts
|
||||||
"RUF00", # Ambiguous unicode character and other rules
|
"RUF001", # String contains ambiguous {}. Did you mean {}?
|
||||||
|
"RUF002", # Docstring contains ambiguous {}. Did you mean {}?
|
||||||
|
"RUF003", # Comment contains ambiguous {}. Did you mean {}?
|
||||||
|
"RUF007", # Prefer itertools.pairwise() over zip() when iterating over successive pairs
|
||||||
"S101", # Use of `assert` detected -- DO NOT FIX
|
"S101", # Use of `assert` detected -- DO NOT FIX
|
||||||
"S113", # Probable use of requests call without timeout -- FIX ME
|
"S113", # Probable use of requests call without timeout -- FIX ME
|
||||||
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
|
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
|
||||||
|
|
Loading…
Reference in New Issue
Block a user