File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,17 @@ def generate_javecore_set_data(files):
146146 javacores_temp_dir .cleanup ()
147147
148148
149+ # Assisted by watsonx Code Assistant
149150def create_output_files_structure (output_dir ):
151+ """
152+ Creates the output report directory structure and copies necessary files.
153+
154+ Args:
155+ output_dir (str): The output directory path.
156+
157+ Returns:
158+ None
159+ """
150160 if not os .path .isdir (output_dir ):
151161 os .mkdir (output_dir )
152162 data_output_dir = os .path .normpath (os .path .join (output_dir , 'data' ))
@@ -164,7 +174,18 @@ def create_output_files_structure(output_dir):
164174 os .path .join (output_dir , "index.html" ))
165175
166176
177+ # Assisted by watsonx Code Assistant
167178def generate_error_page (output_dir , exception ):
179+ """
180+ Generate an error page with a stacktrace.
181+
182+ Args:
183+ output_dir (str): The directory where the error page will be saved.
184+ exception (Exception): The exception that caused the error.
185+
186+ Returns:
187+ None
188+ """
168189 error_page_text = importlib_resources .read_text ("javacore_analyser" , "data/html/error.html" )
169190 tb = traceback .format_exc ()
170191 file = os .path .join (output_dir , "index.html" )
Original file line number Diff line number Diff line change @@ -52,7 +52,17 @@ def dir_listing(path):
5252
5353
5454@app .route ('/zip/<path:path>' )
55+ # Assisted by watsonx Code Assistant
5556def compress (path ):
57+ """
58+ Compress a directory and return the compressed file as an attachment.
59+
60+ Args:
61+ path (str): The path to the directory to compress.
62+
63+ Returns:
64+ send_from_directory: The compressed file as an attachment.
65+ """
5666 temp_zip_dir = tempfile .TemporaryDirectory ()
5767 try :
5868 temp_zip_dir_name = temp_zip_dir .name
You can’t perform that action at this time.
0 commit comments