@@ -344,30 +344,28 @@ def add_additional_source_files(
344344 dict | None
345345 Updated package structure or None if no additional files were added.
346346 """
347- is_additional_files = get_config_data_value (config_path , "additional_source_files" )
348- if is_additional_files :
349- # Get all the python files in the template source directory
350- template_source_path = template_path / "src"
351- additional_files = list (template_source_path .glob ("**/*.py" ))
352- if len (additional_files ) > 0 :
353- for file_path in additional_files :
354- relative_path = file_path .relative_to (template_source_path )
355- parts = relative_path .parts
356- if len (parts ) < 2 :
357- continue # Skip files that are not in a module folder
358- module_name = parts [- 2 ]
359- class_file_name = parts [- 1 ][:- 3 ] # Remove .py extension
360- class_name = class_file_name .title ().replace ("_" , "" )
361- if module_name not in package_structure :
362- package_structure [module_name ] = {}
363- if class_file_name not in package_structure [module_name ]:
364- package_structure [module_name ][class_file_name ] = [class_name , []]
365- # read the content of the additional file and update the class structure
366- with open (file_path , "r" , encoding = "utf-8" ) as fid :
367- content = fid .read ()
368- method_names = re .findall (pat .DEF_METHOD , content )
369- package_structure [module_name ][class_file_name ][1 ].extend (method_names )
370- print (module_name , class_file_name , class_name , method_names )
347+ # Get all the python files in the template source directory
348+ template_source_path = template_path / "src"
349+ additional_files = list (template_source_path .glob ("**/*.py" ))
350+ if len (additional_files ) > 0 :
351+ for file_path in additional_files :
352+ relative_path = file_path .relative_to (template_source_path )
353+ parts = relative_path .parts
354+ if len (parts ) < 2 :
355+ continue # Skip files that are not in a module folder
356+ module_name = parts [- 2 ]
357+ class_file_name = parts [- 1 ][:- 3 ] # Remove .py extension
358+ class_name = class_file_name .title ().replace ("_" , "" )
359+ if module_name not in package_structure :
360+ package_structure [module_name ] = {}
361+ if class_file_name not in package_structure [module_name ]:
362+ package_structure [module_name ][class_file_name ] = [class_name , []]
363+ # read the content of the additional file and update the class structure
364+ with open (file_path , "r" , encoding = "utf-8" ) as fid :
365+ content = fid .read ()
366+ method_names = re .findall (pat .DEF_METHOD , content )
367+ package_structure [module_name ][class_file_name ][1 ].extend (method_names )
368+ print (module_name , class_file_name , class_name , method_names )
371369 return package_structure
372370
373371
0 commit comments