From 7185e0b31ba84cb1bae3174d8aa64ab7291a97e2 Mon Sep 17 00:00:00 2001 From: Labrys of Knossos Date: Tue, 15 Jan 2019 17:35:41 -0500 Subject: [PATCH] Add docstring --- cleanup.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cleanup.py b/cleanup.py index 02bdf648..3e1559cf 100644 --- a/cleanup.py +++ b/cleanup.py @@ -37,6 +37,13 @@ class WorkingDirectory(object): def module_path(module=__file__, parent=False): + """ + Detect path for a module. + + :param module: The module who's path is being detected. Defaults to current module. + :param parent: True to return the parent folder of the current module. + :return: The absolute normalized path to the module or its parent. + """ try: path = module.__file__ except AttributeError: @@ -122,6 +129,12 @@ def clean_folders(*paths): def force_clean_folder(path, required): + """ + Force clean a folder and exclude any required subfolders. + + :param path: Target folder to remove subfolders + :param required: Keep only the required subfolders + """ root, dirs, files = next(os.walk(path)) required = sorted(required) if required: