@@ -19,17 +19,22 @@ def parse_build_settings_file(build_settings_file: pathlib.Path) -> dict[str, ty
1919 :return: The build settings dict.
2020 :rtype: dict[str, Any]
2121 """
22- with open (build_settings_file ) as f :
23- build_settings_data = json .load (f )
22+
23+ def check (condition : bool , message : str ):
24+ if not condition :
25+ raise ValueError (message )
2426
2527 # validate that `input` is a dict[str, list[str]]
2628 def validate_str_to_str_list_dict (input : dict [str , list [str ]]):
27- assert isinstance (input , dict ), f"input is not a dict: { input } "
29+ check ( isinstance (input , dict ), f"input is not a dict: { input } " )
2830 for key , value in input .items ():
29- assert isinstance (key , str ), f"key is not a string: { key } "
30- assert isinstance (value , list ), f"value is not a list: { value } "
31+ check ( isinstance (key , str ), f"key is not a string: { key } " )
32+ check ( isinstance (value , list ), f"value is not a list: { value } " )
3133 for value_element in value :
32- assert isinstance (value_element , str ), f"list element is not a string: { value_element } "
34+ check (isinstance (value_element , str ), f"list element is not a string: { value_element } " )
35+
36+ with open (build_settings_file ) as f :
37+ build_settings_data = json .load (f )
3338
3439 build_settings = {}
3540
0 commit comments