More changes suggested in review, generally docstring issues.

This commit is contained in:
Julian Stirling 2025-06-30 17:05:49 +01:00
parent ad838e8643
commit 51f9df995d
5 changed files with 23 additions and 15 deletions

View file

@ -73,8 +73,8 @@ class ScanDirectoryManager:
) -> Optional[str]:
"""Return the file path for the file within a scan directory
If check_exists is True then a FileNotFoundError will be raised if
the file does not exist.
If check_exists is True then None will be returned if the file does
not exist.
"""
file_path = os.path.join(self.path_for(scan_name), filename)
if check_exists:
@ -178,13 +178,10 @@ class ScanDirectoryManager:
"""
Raise an exception if there is not enough free disk space to continue scanning
Args:
path = path to a location on the disk you want to check
min_space [int] = the minimum space required in bytes
default = 500,000,000 (500MB)
:param min_space: the minimum space required in bytes.
Default = 500,000,000 (500MB)
Raises:
NotEnoughFreeSpaceError if the remaining storage is below min_space
:raises: NotEnoughFreeSpaceError if the remaining storage is below min_space
"""
disk_usage = shutil.disk_usage(self._base_scan_dir)
if disk_usage.free < min_space:
@ -198,7 +195,8 @@ class ScanDirectory:
"""A class for handling interactions with scan directories
Initalisation parameters:
dir_path: the directory of the outer scan directory
name: the name of the scan (the scan directory basename)
base_scan_dir: Path of the directory that holds all scans
"""
_name: str

View file

@ -49,7 +49,7 @@ STITCHING_RESOLUTION = (820, 616)
class ScanNotRunningError(RuntimeError):
"""Method called when scan not running that requires a scan to be running"""
"""Exception called when scan not running that requires a scan to be running"""
def _scan_running(method):
@ -138,8 +138,8 @@ class SmartScanThing(Thing):
self._capture_thread = None
self._scan_images_taken = 0
# Set _scan_data to None. It will for error checking. It will be set to a value
# by _run_scan
# Set _scan_data to None. This is needed just in case an exception is raised
# before _run_scan (which sets the real data). As we check this in the `except`
self._scan_data = None
try: