diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-10-01 13:15:29 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2023-10-01 13:15:29 +0200 |
| commit | f32cca1de7a3c2edd3da54f56fc711c4e5af6506 (patch) | |
| tree | e5808565007ff4c53efa24afb4158b458451cbd8 /scripts/gen_map | |
| parent | 8f0be4200f9e93ccd35d60cc0a5436ab5f168c8b (diff) | |
| download | unterricht-f32cca1de7a3c2edd3da54f56fc711c4e5af6506.tar.gz unterricht-f32cca1de7a3c2edd3da54f56fc711c4e5af6506.zip | |
add more type hints and ensure we are using the correct types
Diffstat (limited to 'scripts/gen_map')
| -rwxr-xr-x | scripts/gen_map/gen_map.py | 12 |
1 files changed, 7 insertions, 5 deletions
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' |
