Convert Stage to a Protocol

The Stage is now implemented as a runtime-checkable Protocol.

Part of this led to the realisation that we can't create a DirectThingClient
based on a Protocol, only on a concrete Thing. While it might be
a good idea to address that in LabThings in due course, for now
we work around it by creating both a Protocol and a stub class. The stub class implements the protocol, and
can be used to declare a dependency.
This commit is contained in:
Richard Bowman 2024-11-29 12:53:04 +00:00
parent 2e2e877d75
commit a0fbbc3e40
7 changed files with 77 additions and 25 deletions

View file

@ -25,7 +25,7 @@ from labthings_fastapi.types.numpy import NDArray
from labthings_fastapi.server import ThingServer
from . import BaseCamera, JPEGBlob
from ..stage import Stage
from ..stage import StageProtocol as Stage
class SimulatedCamera(BaseCamera):