diff --git a/pyproject.toml b/pyproject.toml index bb3a4cb7..cf4c5bb4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -102,7 +102,7 @@ select = [ # "PL", # Pylint (a subset of, catches far less than pylint does) # "B", # Flake8 bugbear "A", # Flake8 builtins checker -# "C", # Flake8 comprehensions + "C", # Flake8 comprehensions # "FIX", #TODO/FIXME's in code. These should be added during develoment for ongoing tasks. # If they are not fixed before merge they should be converted to GitLab issues # "LOG", # Flake8 logging issues (pedantic logger formatting issues can be added with "G") diff --git a/src/openflexure_microscope_server/things/camera_stage_mapping.py b/src/openflexure_microscope_server/things/camera_stage_mapping.py index e26bf27b..4e4f1d53 100644 --- a/src/openflexure_microscope_server/things/camera_stage_mapping.py +++ b/src/openflexure_microscope_server/things/camera_stage_mapping.py @@ -87,7 +87,7 @@ def make_hardware_interface( axes = stage.axis_names def pos2dict(pos: Sequence[float]) -> Mapping[str, float]: - return {k: p for k, p in zip(axes, pos)} + return dict(zip(axes, pos)) def dict2pos(posd: Mapping[str, float]) -> Sequence[float]: return tuple(posd[k] for k in axes if k in posd) diff --git a/src/openflexure_microscope_server/things/stage/__init__.py b/src/openflexure_microscope_server/things/stage/__init__.py index cc7c1bc3..81e30ce6 100644 --- a/src/openflexure_microscope_server/things/stage/__init__.py +++ b/src/openflexure_microscope_server/things/stage/__init__.py @@ -80,7 +80,7 @@ class BaseStage(Thing): position = PropertyDescriptor( Mapping[str, int], - {k: 0 for k in _axis_names}, + dict.fromkeys(_axis_names, 0), description="Current position of the stage", readonly=True, observable=True, diff --git a/src/openflexure_microscope_server/things/stage/dummy.py b/src/openflexure_microscope_server/things/stage/dummy.py index 2608da7d..044a6625 100644 --- a/src/openflexure_microscope_server/things/stage/dummy.py +++ b/src/openflexure_microscope_server/things/stage/dummy.py @@ -91,5 +91,5 @@ class DummyStage(BaseStage): It is intended for use after manually or automatically recentring the stage. """ - self.position = {k: 0 for k in self.axis_names} + self.position = dict.fromkeys(self.axis_names, 0) self.instantaneous_position = self.position