Skip to content
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

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

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions .flake8
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
cclauss marked this conversation as resolved.
Show resolved Hide resolved
cclauss marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 2 additions & 3 deletions genetic_algorithm/basic_string.py
Expand Up @@ -129,9 +129,8 @@ 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]
random_x = random.randint(0, N_SELECTED)
parent_2 = population_score[random_x][0]

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