mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-24 13:31:07 +00:00
Enable ruff RUF005 rule
This commit is contained in:
parent
f8cdb3e948
commit
f5ed227553
|
@ -336,7 +336,7 @@ def inorder(curr_node: Node | None) -> list[Node]:
|
|||
"""
|
||||
node_list = []
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ def subset_combinations(elements: list[int], n: int) -> list:
|
|||
for i in range(1, r + 1):
|
||||
for j in range(i, 0, -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:
|
||||
return sorted(dp[n])
|
||||
|
|
|
@ -33,7 +33,7 @@ def odd_sieve(num: int) -> list[int]:
|
|||
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__":
|
||||
|
|
|
@ -13,7 +13,10 @@ lint.ignore = [ # `ruff rule S101` for a description of that rule
|
|||
"PLW2901", # PLW2901: Redefined loop variable -- FIX ME
|
||||
"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
|
||||
"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
|
||||
"S113", # Probable use of requests call without timeout -- FIX ME
|
||||
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes -- FIX ME
|
||||
|
|
Loading…
Reference in New Issue
Block a user