From 110551f1bf6697299c94ab67ed8165a77636ecef Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 23 Dec 2021 17:45:46 -0800 Subject: [PATCH] Add docstring to reserve_disk_space. --- reserve_disk_space.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/reserve_disk_space.py b/reserve_disk_space.py index 86b90f1..2285e09 100644 --- a/reserve_disk_space.py +++ b/reserve_disk_space.py @@ -31,10 +31,21 @@ class NotEnoughSpace(Exception): self.drive = drive def reserve_disk_space(reserve, drive): + ''' + Returns a dotdict containing these values: + { + 'free': integer number of free bytes, + 'reserve': integer number of requested bytes, + 'drive': path string representing the drive we checked + } + + Raises NotEnoughSpace if the amount of free disk space on `drive` is less + than `free`. + ''' drive = os.path.abspath(drive) drive = os.path.splitdrive(drive)[0] - log.debug('Checking drive %s', drive) + log.debug('Checking drive %s.', drive) free = shutil.disk_usage(drive).free if free < reserve: