From cc5f0cc383983959aa970f1a63b4aea9efc7b977 Mon Sep 17 00:00:00 2001 From: Eddasol Date: Fri, 6 Dec 2024 15:53:43 +0100 Subject: [PATCH] Move mediaconfig to prevent circular dependencies --- src/isar/apis/models/media_connection_type.py | 5 ----- src/isar/apis/models/models.py | 9 --------- src/isar/services/utilities/robot_utilities.py | 2 +- src/robot_interface/models/robots/media.py | 13 +++++++++++++ src/robot_interface/robot_interface.py | 2 +- tests/mocks/robot_interface.py | 5 ++--- 6 files changed, 17 insertions(+), 19 deletions(-) delete mode 100644 src/isar/apis/models/media_connection_type.py create mode 100644 src/robot_interface/models/robots/media.py diff --git a/src/isar/apis/models/media_connection_type.py b/src/isar/apis/models/media_connection_type.py deleted file mode 100644 index 6530adcf..00000000 --- a/src/isar/apis/models/media_connection_type.py +++ /dev/null @@ -1,5 +0,0 @@ -from enum import Enum - - -class MediaConnectionType(str, Enum): - LiveKit: str = "LiveKit" diff --git a/src/isar/apis/models/models.py b/src/isar/apis/models/models.py index be024b20..48289016 100644 --- a/src/isar/apis/models/models.py +++ b/src/isar/apis/models/models.py @@ -1,8 +1,6 @@ -from dataclasses import dataclass from typing import List, Optional from alitra import Frame, Orientation, Pose, Position -from isar.apis.models.media_connection_type import MediaConnectionType from pydantic import BaseModel, Field from robot_interface.models.mission.task import TaskTypes @@ -35,13 +33,6 @@ class RobotInfoResponse(BaseModel): plant_short_name: str -@dataclass -class MediaConfig: - url: str - token: str - media_connection_type: MediaConnectionType - - class InputOrientation(BaseModel): x: float y: float diff --git a/src/isar/services/utilities/robot_utilities.py b/src/isar/services/utilities/robot_utilities.py index d698e0ec..7c10edc3 100644 --- a/src/isar/services/utilities/robot_utilities.py +++ b/src/isar/services/utilities/robot_utilities.py @@ -2,7 +2,7 @@ from injector import inject -from isar.apis.models.models import MediaConfig +from robot_interface.models.robots.media import MediaConfig from robot_interface.robot_interface import RobotInterface diff --git a/src/robot_interface/models/robots/media.py b/src/robot_interface/models/robots/media.py new file mode 100644 index 00000000..11c400d4 --- /dev/null +++ b/src/robot_interface/models/robots/media.py @@ -0,0 +1,13 @@ +from dataclasses import dataclass +from enum import Enum + + +class MediaConnectionType(str, Enum): + LiveKit: str = "LiveKit" + + +@dataclass +class MediaConfig: + url: str + token: str + media_connection_type: MediaConnectionType diff --git a/src/robot_interface/robot_interface.py b/src/robot_interface/robot_interface.py index 97023a21..3255ef1e 100644 --- a/src/robot_interface/robot_interface.py +++ b/src/robot_interface/robot_interface.py @@ -3,7 +3,7 @@ from threading import Thread from typing import Callable, List -from isar.apis.models.models import MediaConfig +from robot_interface.models.robots.media import MediaConfig from robot_interface.models.initialize import InitializeParams from robot_interface.models.inspection.inspection import Inspection from robot_interface.models.mission.mission import Mission diff --git a/tests/mocks/robot_interface.py b/tests/mocks/robot_interface.py index 1744a87c..e5d651b6 100644 --- a/tests/mocks/robot_interface.py +++ b/tests/mocks/robot_interface.py @@ -6,8 +6,8 @@ from alitra import Frame, Orientation, Pose, Position -from isar.apis.models.media_connection_type import MediaConnectionType -from isar.apis.models.models import MediaConfig +from robot_interface.models.robots.media import MediaConnectionType +from robot_interface.models.robots.media import MediaConfig from robot_interface.models.initialize import InitializeParams from robot_interface.models.inspection.inspection import ( Image, @@ -22,7 +22,6 @@ class MockRobot(RobotInterface): - def __init__( self, mission_status: MissionStatus = MissionStatus.Successful,