Apply suggestions from code review of branch yet-another-smart-scan-refactor

Co-authored-by: Joe Knapper <joe.knapper@glasgow.ac.uk>
This commit is contained in:
Julian Stirling 2025-08-06 15:52:52 +00:00
parent 6739a84d7c
commit 2e6ba73345
2 changed files with 5 additions and 1 deletions

View file

@ -702,7 +702,7 @@ class SmartScanThing(lt.Thing):
"""
scan_data_dict = self._scan_dir_manager.get_scan_data_dict(scan_name)
if scan_data_dict is None:
logger.warning("Couldn't read scan data it may be missing or corrupt.")
logger.warning("Couldn't read scan data - it may be missing or corrupt.")
final_stitcher = stitching.FinalStitcher(
self._scan_dir_manager.img_dir_for(scan_name),
logger=logger,
@ -712,6 +712,7 @@ class SmartScanThing(lt.Thing):
scan_data_dict=scan_data_dict,
)
try:
# start the final stitch, providing the cancel hook to allow aborting
final_stitcher.start(cancel)
except lt.exceptions.InvocationCancelledError:
# Sleep for 1 second just to allow invocation logs to pass to user.

View file

@ -128,8 +128,11 @@ def _wrap_and_catch_errors(target, error_buffer, *args, **kwargs):
# Compiled regular expressions for unsafe characters
# Matches anything that isn't a-z, A-Z, 0-9, _, ., -, :, /, \
_WINDOWS_UNSAFE_PATTERN = re.compile(r"[^a-zA-Z0-9_.\-:/\\]")
# Matches anything that isn't a-z, A-Z, 0-9, _, ., -, \
_POSIX_UNSAFE_PATTERN = re.compile(r"[^a-zA-Z0-9_.\-/]")
# Matches anything that isn't a-z, A-Z, 0-9, _, ., -
_NAME_UNSAFE_PATTERN = re.compile(r"[^a-zA-Z0-9_.\-]")