aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-10-01 13:15:29 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-10-01 13:15:29 +0200
commitf32cca1de7a3c2edd3da54f56fc711c4e5af6506 (patch)
treee5808565007ff4c53efa24afb4158b458451cbd8
parent8f0be4200f9e93ccd35d60cc0a5436ab5f168c8b (diff)
downloadunterricht-f32cca1de7a3c2edd3da54f56fc711c4e5af6506.tar.gz
unterricht-f32cca1de7a3c2edd3da54f56fc711c4e5af6506.zip
add more type hints and ensure we are using the correct types
-rwxr-xr-xscripts/gen_map/gen_map.py12
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'