Enable ruff RUF005 rule (#11344)

This commit is contained in:
Maxim Smolskiy 2024-04-02 22:18:47 +03:00 committed by GitHub
parent f437f92279
commit f5bbea3776
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 4 deletions

View File

@ -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

View File

@ -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])

View File

@ -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__":

View File

@ -12,7 +12,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