From 1648661ee6f07ee6973cb8c18d5d132c3f3edc21 Mon Sep 17 00:00:00 2001 From: Shivani Date: Thu, 11 Apr 2024 16:52:16 -0400 Subject: [PATCH] Added docstring to clear.py --- cupid/clear.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cupid/clear.py b/cupid/clear.py index 7e06627..869980c 100755 --- a/cupid/clear.py +++ b/cupid/clear.py @@ -1,6 +1,5 @@ #!/usr/bin/env python import os -import sys import click import cupid.util import shutil @@ -19,13 +18,18 @@ def readConfigFile(config_path): return fullPath else: #run_dir is empty/wasn't found in config file so return error - print("ERROR: 'run_dir' was empty/not found in the config file.") - sys.exit(1) + raise ValueError("'run_dir' was empty/not found in the config file.") @click.command() @click.argument('config_path') #Entry point to this script def clear(config_path): + """Clears the contents of the 'computed_notebooks' folder at the location specified by the 'run_dir' variable in the 'config.yml' file. + + Args: config_path - The path to the config.yml file. + + """ + run_dir = readConfigFile(config_path) #Delete the 'computed_notebooks' folder and all the contents inside of it shutil.rmtree(run_dir)