From 67529a8120337044f4e4d0bbb55cb33b3a408268 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Tue, 23 Jan 2024 14:49:41 +0200 Subject: [PATCH] feat(tt_tool): require that clock_hz be an integer --- project_info.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/project_info.py b/project_info.py index 6e108d8..9fc0e39 100644 --- a/project_info.py +++ b/project_info.py @@ -108,10 +108,17 @@ class ProjectInfo: raise ProjectYamlError("No source files specified") self.source_files = project_section["source_files"] + if "clock_hz" not in project_section: + raise ProjectYamlError("Missing key 'clock_hz' in 'project' section") + if not isinstance(project_section["clock_hz"], int): + raise ProjectYamlError( + "Invalid value for 'clock_hz' in 'project' section, must be an integer" + ) + self.clock_hz: int = project_section["clock_hz"] + if "pinout" not in yaml_data: raise ProjectYamlError("Missing 'pinout' section") self.pinout = PinoutSection(yaml_data["pinout"]) self.discord: Optional[str] = project_section.get("discord") self.doc_link: Optional[str] = project_section.get("doc_link") - self.clock_hz: Optional[int] = project_section["clock_hz"]