Clean Code: Apply flake8-simplify to Python

Also flake8-comprehensions which was added to the CI

For flake8-simplify, there are a few false-positives,
e.g. https://github.com/MartinThoma/flake8-simplify/issues/115
This commit is contained in:
Martin Thoma
2022-03-18 22:27:31 +01:00
parent d43ec589c8
commit 3b2739b8a2
28 changed files with 168 additions and 214 deletions

View File

@@ -140,8 +140,6 @@ def get_distance(odd):
return 4
elif d < s + 77:
return 5
elif d < s + 77:
return 5
elif d < s + 92:
return 6
else:
@@ -233,12 +231,10 @@ def print_race_results(race_positions, odds, bets, player_names):
# print the race positions first
basic_print("THE RACE RESULTS ARE:")
position = 1
for horse_idx in reversed(race_positions):
for position, horse_idx in enumerate(reversed(race_positions), start=1):
line = f"{position} PLACE HORSE NO. {horse_idx} AT {odds[horse_idx]}:1"
basic_print("")
basic_print(line)
position += 1
# followed by the amount the players won
winning_horse_idx = race_positions[-1]