From f4b123c237d0eab00476dd130f73858199b7af44 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Thu, 12 Nov 2020 14:28:44 +0000 Subject: [PATCH] Style and linting --- .../api/v2/views/captures.py | 2 - .../api/v2/views/instrument.py | 2 +- openflexure_microscope/paths.py | 1 + .../rescue/check_settings.py | 45 +++++++++++-------- 4 files changed, 28 insertions(+), 22 deletions(-) diff --git a/openflexure_microscope/api/v2/views/captures.py b/openflexure_microscope/api/v2/views/captures.py index f9035498..4b9347fd 100644 --- a/openflexure_microscope/api/v2/views/captures.py +++ b/openflexure_microscope/api/v2/views/captures.py @@ -1,5 +1,3 @@ -import logging - from flask import abort, redirect, request, send_file, url_for from labthings import Schema, fields, find_component from labthings.marshalling import marshal_with, use_args diff --git a/openflexure_microscope/api/v2/views/instrument.py b/openflexure_microscope/api/v2/views/instrument.py index 3056f800..95c237cd 100644 --- a/openflexure_microscope/api/v2/views/instrument.py +++ b/openflexure_microscope/api/v2/views/instrument.py @@ -1,6 +1,6 @@ import logging -from flask import abort, request +from flask import abort from labthings import find_component, fields from labthings.marshalling import use_args from labthings.utilities import create_from_path, get_by_path, set_by_path diff --git a/openflexure_microscope/paths.py b/openflexure_microscope/paths.py index 3442fd74..38998580 100644 --- a/openflexure_microscope/paths.py +++ b/openflexure_microscope/paths.py @@ -38,6 +38,7 @@ def logs_file_path(filename: str): os.makedirs(logs_dir) return os.path.join(logs_dir, filename) + # BASE PATHS if os.name == "nt": diff --git a/openflexure_microscope/rescue/check_settings.py b/openflexure_microscope/rescue/check_settings.py index 562f26c4..62c30be8 100644 --- a/openflexure_microscope/rescue/check_settings.py +++ b/openflexure_microscope/rescue/check_settings.py @@ -8,36 +8,41 @@ ERROR_SOURCES = [] def trace_config_exceptions(): error_sources = [] - from openflexure_microscope.paths import ( - CONFIGURATION_FILE_PATH, - SETTINGS_FILE_PATH, - ) + from openflexure_microscope.paths import CONFIGURATION_FILE_PATH, SETTINGS_FILE_PATH try: default_config = json.load(CONFIGURATION_FILE_PATH) if not default_config: - error_sources.append(ErrorSource( - "Configuration file is missing or empty. This may occur if the server has never been started." - )) + error_sources.append( + ErrorSource( + "Configuration file is missing or empty. This may occur if the server has never been started." + ) + ) except Exception as e: # pylint: disable=W0703 logging.error("Error parsing config:") logging.error(e) - error_sources.append(ErrorSource( - f"Configuration file is malformed. You can reset to the default configuration by deleting {CONFIGURATION_FILE_PATH}." - )) + error_sources.append( + ErrorSource( + f"Configuration file is malformed. You can reset to the default configuration by deleting {CONFIGURATION_FILE_PATH}." + ) + ) try: default_settings = json.load(SETTINGS_FILE_PATH) if not default_settings: - error_sources.append(ErrorSource( - "Settings file is missing or empty. This may occur if the server has never been started." - )) + error_sources.append( + ErrorSource( + "Settings file is missing or empty. This may occur if the server has never been started." + ) + ) except Exception as e: # pylint: disable=W0703 logging.error("Error parsing settings:") logging.error(e) - error_sources.append(ErrorSource( - f"Settings file is malformed. You can reset to the default settings by deleting {SETTINGS_FILE_PATH}." - )) + error_sources.append( + ErrorSource( + f"Settings file is malformed. You can reset to the default settings by deleting {SETTINGS_FILE_PATH}." + ) + ) return error_sources @@ -48,9 +53,11 @@ def main(): try: from openflexure_microscope import config as _ except Exception as e: # pylint: disable=W0703 - error_sources.append(ErrorSource( - "Error importing configuration submodule. This could be an error in our code." - )) + error_sources.append( + ErrorSource( + "Error importing configuration submodule. This could be an error in our code." + ) + ) logging.error("Error importing config:") logging.error(e) error_sources.extend(trace_config_exceptions())