From a2ba95c1d36511d512a68db78d47e4a6cfc546a3 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Tue, 27 Apr 2021 11:17:11 +0100 Subject: [PATCH] Minor linting improvements I have now disabled W1203 globally, see comment in pyproject.toml --- openflexure_microscope/api/v2/views/actions/stage.py | 3 --- openflexure_microscope/utilities.py | 2 +- pyproject.toml | 8 +++++++- setup.py | 5 +++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/openflexure_microscope/api/v2/views/actions/stage.py b/openflexure_microscope/api/v2/views/actions/stage.py index d9231bf6..206d9623 100644 --- a/openflexure_microscope/api/v2/views/actions/stage.py +++ b/openflexure_microscope/api/v2/views/actions/stage.py @@ -1,11 +1,8 @@ import logging -from typing import List, Tuple from labthings import fields, find_component from labthings.views import ActionView -from openflexure_microscope.utilities import axes_to_array - class MoveStageAPI(ActionView): args = { diff --git a/openflexure_microscope/utilities.py b/openflexure_microscope/utilities.py index 08512942..1a36f86b 100644 --- a/openflexure_microscope/utilities.py +++ b/openflexure_microscope/utilities.py @@ -4,7 +4,7 @@ import logging import sys import time from contextlib import contextmanager -from typing import Dict, List, Optional, Tuple, Type, Union, Sequence +from typing import Dict, List, Optional, Sequence, Tuple, Type, Union import numpy as np diff --git a/pyproject.toml b/pyproject.toml index 64ac002c..60a5c539 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,7 +25,13 @@ ensure_newline_before_comments = true line_length = 88 [tool.pylint.'MESSAGES CONTROL'] -disable = "fixme,C,R" +# W1203 warns about using f strings in logging statements. +# I'm really not concerned about the performance implications of this, +# particularly as we often have the log level set quite high. I think +# for our current purposes, using f strings in logging statements is +# more readable and thus a good idea in many places - I've disabled +# this warning code globally for that reason. +disable = "fixme,C,R,W1203" max-line-length = 88 [tool.poe.executor] diff --git a/setup.py b/setup.py index 73269b1a..adf729ff 100644 --- a/setup.py +++ b/setup.py @@ -6,10 +6,11 @@ https://packaging.python.org/guides/distributing-packages-using-setuptools/ """ -# the following imports, from the guide above, prefer `setuptools` to `distutils` -from setuptools import setup, find_packages from os import path +# the following imports, from the guide above, prefer `setuptools` to `distutils` +from setuptools import find_packages, setup + here = path.abspath(path.dirname(__file__)) # Get the long description from the README file