Skip to content

Commit d64300a

Browse files
Merge pull request #145 from IBM/144-document-few-critical-methods
#144 Add documentation for few methods.
2 parents 4f3a7f5 + cef8011 commit d64300a

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/javacore_analyser/javacore_analyser_batch.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff 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
149150
def 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
167178
def 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")

src/javacore_analyser/javacore_analyser_web.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@ def dir_listing(path):
5252

5353

5454
@app.route('/zip/<path:path>')
55+
# Assisted by watsonx Code Assistant
5556
def 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

0 commit comments

Comments
 (0)