Type narrowing for mypy

This commit is contained in:
Julian Stirling 2026-07-02 15:36:38 +01:00
parent cae5a03922
commit 26a2e1a582

View file

@ -363,9 +363,10 @@ class SmartScanThing(OFMThing):
self._preview_stitcher = None
# Set the final details so they persist until the next scan
self._latest_scan_live_details.image_count = final_image_count
self._latest_scan_live_details.stitch_timestamp = last_timestamp
self._latest_scan_live_details.scan_phase = "Complete"
if self._latest_scan_live_details is not None:
self._latest_scan_live_details.image_count = final_image_count
self._latest_scan_live_details.stitch_timestamp = last_timestamp
self._latest_scan_live_details.scan_phase = "Complete"
# Remove any scan folders containing zero images.
self.purge_empty_scans()
@ -480,8 +481,8 @@ class SmartScanThing(OFMThing):
overlap=stitching_settings.overlap,
correlation_resize=stitching_settings.correlation_resize,
)
self._latest_scan_live_details.scan_phase = "Scanning"
if self._latest_scan_live_details is not None:
self._latest_scan_live_details.scan_phase = "Scanning"
# This is the main loop of the scan!
self._main_scan_loop(workflow)
self._save_final_scan_data(scan_result="success")
@ -586,7 +587,8 @@ class SmartScanThing(OFMThing):
@_scan_running
def _perform_final_stitch(self) -> None:
"""Update the scan zip and perform final stitch of the data."""
self._latest_scan_live_details.scan_phase = "Stitching"
if self._latest_scan_live_details is not None:
self._latest_scan_live_details.scan_phase = "Stitching"
if self.scan_data.image_count <= 1:
self.logger.info("Not performing a stitch as not enough images captured")
return