mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-06-13 00:07:11 +02:00
feat: updating utils
- moving apply_update_to_data_service to data_service and renaming to update_DataService_by_path - splitting function into several logical parts - adding and rewriting multiple helper functions
This commit is contained in:
@ -9,18 +9,13 @@ from loguru import logger
|
||||
|
||||
from pyDataInterface import DataService
|
||||
from pyDataInterface.config import OperationMode
|
||||
from pyDataInterface.utils.apply_update_to_data_service import (
|
||||
apply_updates_to_data_service,
|
||||
from pyDataInterface.data_service.data_service import (
|
||||
UpdateDict,
|
||||
update_DataService_by_path,
|
||||
)
|
||||
from pyDataInterface.version import __version__
|
||||
|
||||
|
||||
class FrontendUpdate(TypedDict):
|
||||
name: str
|
||||
parent_path: str
|
||||
value: Any
|
||||
|
||||
|
||||
class WebAPI:
|
||||
__sio_app: socketio.ASGIApp
|
||||
__fastapi_app: FastAPI
|
||||
@ -54,9 +49,9 @@ class WebAPI:
|
||||
sio = socketio.AsyncServer(async_mode="asgi")
|
||||
|
||||
@sio.event # type: ignore
|
||||
def frontend_update(sid: str, data: FrontendUpdate) -> Any:
|
||||
def frontend_update(sid: str, data: UpdateDict) -> Any:
|
||||
logger.debug(f"Received frontend update: {data}")
|
||||
return apply_updates_to_data_service(self.service, data)
|
||||
return update_DataService_by_path(self.service, data)
|
||||
|
||||
self.__sio = sio
|
||||
self.__sio_app = socketio.ASGIApp(self.__sio)
|
||||
|
Reference in New Issue
Block a user