Merge branch 'v3-default-factory-for-dictionaries' into 'v3'

Use a default_factory for dict default values

Closes #750 and #751

See merge request openflexure/openflexure-microscope-server!561
This commit is contained in:
Joe Knapper 2026-05-13 08:03:52 +00:00
commit 04b7d0d4fa
3 changed files with 4 additions and 4 deletions

View file

@ -147,7 +147,7 @@ class BaseStage(lt.Thing):
return self._apply_axis_direction(self._hardware_position)
backlash_steps: dict[str, int] = lt.setting(
default={"x": 200, "y": 200, "z": 200}, readonly=True
default_factory=lambda: {"x": 200, "y": 200, "z": 200}, readonly=True
)
"""The number of steps to elimate backlash. The sign sets the direction.
@ -161,7 +161,7 @@ class BaseStage(lt.Thing):
"""Whether the stage is in motion."""
axis_inverted: dict[str, bool] = lt.setting(
default={"x": False, "y": False, "z": False}, readonly=True
default_factory=lambda: {"x": False, "y": False, "z": False}, readonly=True
)
"""Used to convert coordinates between the program frame and the hardware frame."""

View file

@ -77,7 +77,7 @@ class DummyStage(BaseStage):
self._move_thread.join()
axis_inverted: dict[str, bool] = lt.setting(
default={"x": True, "y": False, "z": False}, readonly=True
default_factory=lambda: {"x": True, "y": False, "z": False}, readonly=True
)
"""Used to convert coordinates between the program frame and the hardware frame."""

View file

@ -76,7 +76,7 @@ class SangaboardThing(BaseStage):
self._sangaboard.close()
axis_inverted: dict[str, bool] = lt.setting(
default={"x": True, "y": False, "z": True}, readonly=True
default_factory=lambda: {"x": True, "y": False, "z": True}, readonly=True
)
"""Used to convert coordinates between the program frame and the hardware frame."""