11import os
2- import yaml
32from pathlib import Path
43import report as r
54from typing import Dict , List , Union , Tuple
@@ -195,7 +194,7 @@ def generate_section_data(section_folder: Path, base_folder: Path) -> Dict[str,
195194
196195 for subsection_folder in sorted_subsections :
197196 if subsection_folder .is_dir ():
198- section_data ["subsections" ].append (generate_subsection_data (subsection_folder , base_folder ))
197+ section_data ["subsections" ].append (generate_subsection_data (subsection_folder ))
199198
200199 return section_data
201200
@@ -261,34 +260,4 @@ def generate_yaml_structure(folder: str) -> Tuple[Dict[str, Union[str, List[Dict
261260 if section_folder .is_dir ():
262261 yaml_structure ["sections" ].append (generate_section_data (section_folder , folder_path ))
263262
264- return yaml_structure , folder_path
265-
266- def write_yaml_to_file (yaml_data : Dict , folder_path : Path ) -> None :
267- """
268- Writes the generated YAML structure to a file.
269-
270- Parameters
271- ----------
272- yaml_data : Dict
273- The YAML data to write.
274- folder_path : Path
275- The path where the YAML file should be saved.
276-
277- Returns
278- -------
279- None
280- """
281- assert isinstance (yaml_data , dict ), "YAML data must be a dictionary."
282-
283- # Generate the output YAML file path based on the folder name
284- output_yaml = folder_path / (folder_path .name + "_config.yaml" )
285-
286- # Ensure the directory exists (but don't create a new folder)
287- if not folder_path .exists ():
288- raise FileNotFoundError (f"The directory { folder_path } does not exist." )
289-
290- # Now write the YAML file
291- with open (output_yaml , "w" ) as yaml_file :
292- yaml .dump (yaml_data , yaml_file , default_flow_style = False , sort_keys = False )
293-
294- print (f"YAML file has been written to { output_yaml } " )
263+ return yaml_structure , folder_path
0 commit comments