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

@@ -211,7 +211,7 @@ def jump_stats(previous_jumps, chute_altitude):
return n_previous_jumps, n_better
def print_splat(time_on_impact):
def print_splat(time_on_impact) -> None:
"""Parachute opened too late!"""
print(f"{time_on_impact:.2f}\t\tSPLAT")
print(
@@ -232,7 +232,7 @@ def print_splat(time_on_impact):
)
def print_results(n_previous_jumps, n_better):
def print_results(n_previous_jumps, n_better) -> None:
"""Compare current jump to previous successful jumps."""
k = n_previous_jumps
k1 = n_better
@@ -277,13 +277,13 @@ def print_results(n_previous_jumps, n_better):
)
def print_centered(msg):
def print_centered(msg: str) -> None:
"""Print centered text."""
spaces = " " * ((PAGE_WIDTH - len(msg)) // 2)
print(spaces + msg)
def print_header():
def print_header() -> None:
print_centered("SPLAT")
print_centered("CREATIVE COMPUTING MORRISTOWN, NEW JERSEY")
print(