Use a default_factory for dict default values

This MR swaps two stage settings, backlash_steps and axis_inverted to use a default factory function instead of a plain default value.

This is good practice, because the default value is currently a dictionary, which is a mutable object (#751). Mutable default values can cause crosstalk between objects, which I spotted while testing out some upstream changes in LabThings (#750 (closed)).

Closes #750 (closed) Closes #751

This MR contains the following

  • Change BaseStage.backlash_steps and BaseStage.axis_inverted to use a default factory
  • Change the redefinitions of axis_inverted in SangaboardThing and DummyStage to use a default factory

Merge checklist:

I'm not sure how important it is to test this on a microscope - I will try to get to it, but won't manage today.

  • All new/changed functions have up to date typehints and docstrings
  • [ ] Any UI updates have a before and after screenshot in the MR description
  • [ ] Unit testing of new functionality has similar or better coverage than similar existing code
  • This code has been tested on a microscope
    • [ ] Webapp has been recompiled, with aesthetic changes checked in light and dark mode (if changed)
    • [ ] With updated settings JSON (if changed)
    • SmartScan and live stitching work

Merge request reports

Loading