Add ruff checking for unnecessary comprehensions

This commit is contained in:
Julian Stirling 2025-06-10 15:09:18 +01:00
parent 2050c2dc7c
commit 1c54d25212
4 changed files with 4 additions and 4 deletions

View file

@ -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)

View file

@ -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,

View file

@ -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