Skip to content

FIx pre-commit failing - Add B023 to .flake8 ignores #7941

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

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ extend-ignore =
# Formatting style for `black`
E203 # Whitespace before ':'
W503 # Line break occurred before a binary operator
B023 # Function definition does not bind loop variable
4 changes: 1 addition & 3 deletions genetic_algorithm/basic_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ def select(parent_1: tuple[str, float]) -> list[str]:
child_n = int(parent_1[1] * 100) + 1
child_n = 10 if child_n >= 10 else child_n
for _ in range(child_n):
parent_2 = population_score[ # noqa: B023
random.randint(0, N_SELECTED)
][0]
parent_2 = population_score[random.randint(0, N_SELECTED)][0]

child_1, child_2 = crossover(parent_1[0], parent_2)
# Append new string to the population list.
Expand Down