From f32cca1de7a3c2edd3da54f56fc711c4e5af6506 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sun, 1 Oct 2023 13:15:29 +0200 Subject: add more type hints and ensure we are using the correct types --- scripts/gen_map/gen_map.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'scripts/gen_map/gen_map.py') diff --git a/scripts/gen_map/gen_map.py b/scripts/gen_map/gen_map.py index 8765336b..b3a01e34 100755 --- a/scripts/gen_map/gen_map.py +++ b/scripts/gen_map/gen_map.py @@ -285,7 +285,7 @@ def gen_latex_table( def print_map(rows: list[str], template_path: Path, outfile, - map_info: dict[t.Union[str, datetime]]): + map_info: dict[str, t.Union[str, datetime]]): """Print the template including the generated table""" with open(template_path, 'r', encoding='utf-8') as template_file: template = template_file.readlines() @@ -293,11 +293,13 @@ def print_map(rows: list[str], template_path: Path, outfile, template_prefix = template[:-8] for i, line in enumerate(template_prefix): if r'Start' in line: - template_prefix[ - i] = f'\\Start{{{map_info["start"].strftime("%d.%m.%y")}}}\n' + start = map_info["start"] + assert isinstance(start, datetime) + template_prefix[i] = f'\\Start{{{start.strftime("%d.%m.%y")}}}\n' elif 'End' in line: - template_prefix[ - i] = f'\\End{{{map_info["end"].strftime("%d.%m.%y")}}}\n' + end = map_info["end"] + assert isinstance(end, datetime) + template_prefix[i] = f'\\End{{{end.strftime("%d.%m.%y")}}}\n' elif 'Klasse' in line: template_prefix[i] = f'\\Klasse{{{map_info["form"]}?}}\n' -- cgit v1.2.3