Skip to content

Commit

Permalink
MNT: Rename MCast to MCT (for MultiCamTracker as per #43)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaughantnrc committed Jun 26, 2024
1 parent 07624f3 commit 8ab87ca
Show file tree
Hide file tree
Showing 88 changed files with 456 additions and 475 deletions.
4 changes: 2 additions & 2 deletions src/calibrator/api/add_calibration_image_request.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastRequest
from src.common import MCTRequest
from src.common.structures import CaptureFormat
from pydantic import Field


class AddCalibrationImageRequest(MCastRequest):
class AddCalibrationImageRequest(MCTRequest):
"""
Calibrator will infer resolution from the image itself, and associate its own label to the data.
"""
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/add_calibration_image_response.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastResponse
from src.common import MCTResponse
from pydantic import Field


class AddCalibrationImageResponse(MCastResponse):
class AddCalibrationImageResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "add_calibration_image"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/calibrate_request.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastRequest
from src.common import MCTRequest
from src.common.structures import ImageResolution
from pydantic import Field


class CalibrateRequest(MCastRequest):
class CalibrateRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "calibrate"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/calibrate_response.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastResponse
from src.common import MCTResponse
from src.common.structures import IntrinsicCalibration
from pydantic import Field


class CalibrateResponse(MCastResponse):
class CalibrateResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "calibrate"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/delete_staged_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class DeleteStagedRequest(MCastRequest):
class DeleteStagedRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "clear_calibration_data_staged_for_deletion"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/get_calibration_image_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class GetCalibrationImageRequest(MCastRequest):
class GetCalibrationImageRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_image"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/get_calibration_image_response.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastResponse
from src.common import MCTResponse
from pydantic import Field


class GetCalibrationImageResponse(MCastResponse):
class GetCalibrationImageResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_image"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/get_calibration_result_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class GetCalibrationResultRequest(MCastRequest):
class GetCalibrationResultRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_result"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/get_calibration_result_response.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastResponse
from src.common import MCTResponse
from src.common.structures import IntrinsicCalibration
from pydantic import Field


class GetCalibrationResultResponse(MCastResponse):
class GetCalibrationResultResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_result"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class ListCalibrationDetectorResolutionsRequest(MCastRequest):
class ListCalibrationDetectorResolutionsRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "list_calibration_detector_resolutions"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastResponse
from src.common import MCTResponse
from src.common.structures import DetectorResolution
from pydantic import Field


class ListCalibrationDetectorResolutionsResponse(MCastResponse):
class ListCalibrationDetectorResolutionsResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "list_calibration_detector_resolutions"
Expand Down
4 changes: 2 additions & 2 deletions src/calibrator/api/list_calibration_image_metadata_request.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastRequest
from src.common import MCTRequest
from src.common.structures import ImageResolution
from pydantic import Field


class ListCalibrationImageMetadataRequest(MCastRequest):
class ListCalibrationImageMetadataRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_metadata_identifier_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..structures import CalibrationImageMetadata
from src.common import MCastResponse
from src.common import MCTResponse
from pydantic import Field


class ListCalibrationImageMetadataResponse(MCastResponse):
class ListCalibrationImageMetadataResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_metadata_identifier_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from src.common import MCastRequest
from src.common import MCTRequest
from src.common.structures import ImageResolution
from pydantic import Field


class ListCalibrationResultMetadataRequest(MCastRequest):
class ListCalibrationResultMetadataRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_result_metadata_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..structures import CalibrationResultMetadata
from src.common import MCastResponse
from src.common import MCTResponse
from pydantic import Field


class ListCalibrationResultMetadataResponse(MCastResponse):
class ListCalibrationResultMetadataResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "get_calibration_result_metadata_list"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..structures import CalibrationImageState
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class UpdateCalibrationImageMetadataRequest(MCastRequest):
class UpdateCalibrationImageMetadataRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "update_calibration_image_metadata"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from ..structures import CalibrationResultState
from src.common import MCastRequest
from src.common import MCTRequest
from pydantic import Field


class UpdateCalibrationResultMetadataRequest(MCastRequest):
class UpdateCalibrationResultMetadataRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "update_calibration_result_metadata"
Expand Down
10 changes: 5 additions & 5 deletions src/calibrator/calibrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
ErrorResponse, \
get_kwarg, \
ImageCoding, \
MCastComponent, \
MCastRequest, \
MCastResponse
MCTComponent, \
MCTRequest, \
MCTResponse
from src.common.structures import \
DetectorResolution, \
ImageResolution, \
Expand Down Expand Up @@ -86,8 +86,8 @@ def __init__(
self.add_status_message(severity="critical", message=message)
raise RuntimeError(message)

def supported_request_types(self) -> dict[type[MCastRequest], Callable[[dict], MCastResponse]]:
return_value: dict[type[MCastRequest], Callable[[dict], MCastResponse]] = super().supported_request_types()
def supported_request_types(self) -> dict[type[MCTRequest], Callable[[dict], MCTResponse]]:
return_value: dict[type[MCTRequest], Callable[[dict], MCTResponse]] = super().supported_request_types()
return return_value

def add_calibration_image(self, **kwargs) -> AddCalibrationImageResponse | ErrorResponse:
Expand Down
12 changes: 6 additions & 6 deletions src/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
DequeueStatusMessagesResponse, \
EmptyResponse, \
ErrorResponse, \
MCastParsable, \
MCastRequest, \
MCastRequestSeries, \
MCastResponse, \
MCastResponseSeries
MCTParsable, \
MCTRequest, \
MCTRequestSeries, \
MCTResponse, \
MCTResponseSeries
from .client_identifier_from_connection import client_identifier_from_connection
from .get_kwarg import get_kwarg
from .image_coding import ImageCoding
from .image_utils import ImageUtils
from .mcast_component import MCastComponent
from .mct_component import MCTComponent
from .standard_resolutions import StandardResolutions
from .status_message_source import StatusMessageSource
10 changes: 5 additions & 5 deletions src/common/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from .dequeue_status_messages_response import DequeueStatusMessagesResponse
from .empty_response import EmptyResponse
from .error_response import ErrorResponse
from .mcast_parsable import MCastParsable
from .mcast_request import MCastRequest
from .mcast_request_series import MCastRequestSeries
from .mcast_response import MCastResponse
from .mcast_response_series import MCastResponseSeries
from .mct_parsable import MCTParsable
from .mct_request import MCTRequest
from .mct_request_series import MCTRequestSeries
from .mct_response import MCTResponse
from .mct_response_series import MCTResponseSeries
4 changes: 2 additions & 2 deletions src/common/api/dequeue_status_messages_request.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .mcast_request import MCastRequest
from .mct_request import MCTRequest
from pydantic import Field


class DequeueStatusMessagesRequest(MCastRequest):
class DequeueStatusMessagesRequest(MCTRequest):
@staticmethod
def parsable_type_identifier() -> str:
return "dequeue_status_messages"
Expand Down
4 changes: 2 additions & 2 deletions src/common/api/dequeue_status_messages_response.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from .mcast_response import MCastResponse
from .mct_response import MCTResponse
from src.common.structures.status_message import StatusMessage
from pydantic import Field


class DequeueStatusMessagesResponse(MCastResponse):
class DequeueStatusMessagesResponse(MCTResponse):

@staticmethod
def parsable_type_identifier() -> str:
Expand Down
4 changes: 2 additions & 2 deletions src/common/api/empty_response.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .mcast_response import MCastResponse
from .mct_response import MCTResponse
from pydantic import Field


class EmptyResponse(MCastResponse):
class EmptyResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "empty"
Expand Down
4 changes: 2 additions & 2 deletions src/common/api/error_response.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .mcast_response import MCastResponse
from .mct_response import MCTResponse
from pydantic import Field


class ErrorResponse(MCastResponse):
class ErrorResponse(MCTResponse):
@staticmethod
def parsable_type_identifier() -> str:
return "error"
Expand Down
7 changes: 0 additions & 7 deletions src/common/api/mcast_request.py

This file was deleted.

6 changes: 0 additions & 6 deletions src/common/api/mcast_request_series.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/common/api/mcast_response.py

This file was deleted.

7 changes: 0 additions & 7 deletions src/common/api/mcast_response_series.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from src.common.exceptions import ParsingError
from src.common.exceptions import MCTParsingError
import abc
from pydantic import ValidationError
from typing import TypeVar


ParsableDynamic = TypeVar('ParsableDynamic', bound='MCastParsable')
ParsableDynamic = TypeVar('ParsableDynamic', bound='MCTParsable')


class MCastParsable(abc.ABC):
class MCTParsable(abc.ABC):

@staticmethod
@abc.abstractmethod
Expand All @@ -21,14 +21,14 @@ def parse_dynamic_series_list(
) -> list[ParsableDynamic]:
if "series" not in parsable_series_dict or not isinstance(parsable_series_dict["series"], list):
message: str = "parsable_series_dict did not contain field series. Input is improperly formatted."
raise ParsingError(message)
raise MCTParsingError(message)

output_series: list[ParsableDynamic] = list()
for parsable_dict in parsable_series_dict["series"]:
if not isinstance(parsable_dict, dict):
message: str = "series contained a non-dict element. Input is improperly formatted."
raise ParsingError(message)
output_series.append(MCastParsable.parse_dynamic_single(
raise MCTParsingError(message)
output_series.append(MCTParsable.parse_dynamic_single(
parsable_dict=parsable_dict,
supported_types=supported_types))

Expand All @@ -41,16 +41,16 @@ def parse_dynamic_single(
) -> ParsableDynamic:
if "parsable_type" not in parsable_dict or not isinstance(parsable_dict["parsable_type"], str):
message: str = "parsable_dict did not contain parsable_type. Input is improperly formatted."
raise ParsingError(message) from None
raise MCTParsingError(message) from None

for supported_type in supported_types:
if parsable_dict["parsable_type"] == supported_type.parsable_type_identifier():
request: ParsableDynamic
try:
request = supported_type(**parsable_dict)
except ValidationError as e:
raise ParsingError(f"A request of type {supported_type} was ill-formed: {str(e)}") from None
raise MCTParsingError(f"A request of type {supported_type} was ill-formed: {str(e)}") from None
return request

message: str = "parsable_type did not match any expected value. Input is improperly formatted."
raise ParsingError(message)
raise MCTParsingError(message)
7 changes: 7 additions & 0 deletions src/common/api/mct_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from .mct_parsable import MCTParsable
import abc
from pydantic import BaseModel


class MCTRequest(BaseModel, MCTParsable, abc.ABC):
parsable_type: str
Loading

0 comments on commit 8ab87ca

Please sign in to comment.