Python: Add type annotations to all 'print' functions (#662)

* Add test to superstartrek and fixes several issues in superstartrek - I probably introduced them 🙈
* Mastermind type annotations
This commit is contained in:
Martin Thoma
2022-03-21 10:41:14 +01:00
committed by GitHub
parent c444da93c0
commit 1b1d50986b
50 changed files with 241 additions and 172 deletions

View File

@@ -3,7 +3,7 @@ import random
import time
def basic_print(*zones, **kwargs):
def basic_print(*zones, **kwargs) -> None:
"""Simulates the PRINT command from BASIC to some degree.
Supports `printing zones` if given multiple arguments."""
@@ -92,7 +92,7 @@ def setup_horses():
return [round(total / odd, 2) for odd in odds]
def print_horse_odds(odds):
def print_horse_odds(odds) -> None:
"""Print the odds for each horse"""
basic_print("")
@@ -146,7 +146,7 @@ def get_distance(odd):
return 7
def print_race_state(total_distance, race_pos):
def print_race_state(total_distance, race_pos) -> None:
"""Outputs the current state/stop of the race.
Each horse is placed according to the distance they have travelled. In
case some horses travelled the same distance, their numbers are printed
@@ -226,7 +226,7 @@ def simulate_race(odds):
time.sleep(1)
def print_race_results(race_positions, odds, bets, player_names):
def print_race_results(race_positions, odds, bets, player_names) -> None:
"""Print the race results, as well as the winnings of each player"""
# print the race positions first