Skip to content

Enable ruff RUF005 rule #11344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data_structures/binary_tree/binary_search_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion dynamic_programming/subset_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion maths/odd_sieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__":
Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down