Formatting and linting

This commit is contained in:
Joel Collins 2020-11-06 16:25:56 +00:00
parent 06fb81ec4a
commit cd61ad3b21
2 changed files with 25 additions and 12 deletions

View file

@ -1,7 +1,10 @@
import logging import logging
from logging import error
from openflexure_microscope.captures.capture import build_captures_from_exif, make_file_list, EXIF_FORMATS from openflexure_microscope.captures.capture import (
build_captures_from_exif,
make_file_list,
EXIF_FORMATS,
)
from openflexure_microscope.captures.capture_manager import BASE_CAPTURE_PATH from openflexure_microscope.captures.capture_manager import BASE_CAPTURE_PATH
from openflexure_microscope.config import user_settings from openflexure_microscope.config import user_settings
from openflexure_microscope.rescue.monitor_timeout import launch_timeout_test_process from openflexure_microscope.rescue.monitor_timeout import launch_timeout_test_process
@ -35,17 +38,25 @@ def main():
# Check number of captures being restored # Check number of captures being restored
files = make_file_list(cap_path, EXIF_FORMATS) files = make_file_list(cap_path, EXIF_FORMATS)
if len(files) >= 10000: if len(files) >= 10000:
error_sources.append(WarningSource( error_sources.append(
("Over 10000 captures are being restored. This may slow down server startup.", WarningSource(
f"Consider moving your captures from {cap_path} to another location.") (
)) "Over 10000 captures are being restored. This may slow down server startup.",
f"Consider moving your captures from {cap_path} to another location.",
)
)
)
# Check restore time of captures # Check restore time of captures
passed_timeout = check_capture_reload(cap_path) passed_timeout = check_capture_reload(cap_path)
if not passed_timeout: if not passed_timeout:
error_sources.append(ErrorSource( error_sources.append(
("Capture database rebuilding took a long time. This may not cause catastrophic errors, but rather will cause the server to hang for a while.", ErrorSource(
f"To fix, consider moving your captures from {cap_path} to another location.") (
)) "Capture database rebuilding took a long time. This may not cause catastrophic errors, but rather will cause the server to hang for a while.",
f"To fix, consider moving your captures from {cap_path} to another location.",
)
)
)
return error_sources return error_sources

View file

@ -3,8 +3,10 @@ import logging
from .error_sources import ErrorSource from .error_sources import ErrorSource
picamera_import_error = ErrorSource( picamera_import_error = ErrorSource(
("Picamera module could not be imported.", (
"Check physical connections to the camera as it may be damaged or disconnected.") "Picamera module could not be imported.",
"Check physical connections to the camera as it may be damaged or disconnected.",
)
) )