mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 05:43:16 -07:00
Add docstring
This commit is contained in:
parent
c4be677a62
commit
7185e0b31b
1 changed files with 13 additions and 0 deletions
13
cleanup.py
13
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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue