From 75efde6021e6991657816648bde8bc66c6c3ebe2 Mon Sep 17 00:00:00 2001 From: amit lissack Date: Mon, 4 Jan 2021 08:59:08 -0500 Subject: [PATCH] remove unused types. --- .../service/session/models/command.py | 56 +++++++++---------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/robot-server/robot_server/service/session/models/command.py b/robot-server/robot_server/service/session/models/command.py index 8f0f828b617..f209dce4247 100644 --- a/robot-server/robot_server/service/session/models/command.py +++ b/robot-server/robot_server/service/session/models/command.py @@ -21,6 +21,8 @@ class LoadLabwareRequestData(BaseModel): + """Data field in an equipment.loadLabware command request.""" + location: int = Field( ..., description="Deck slot", ge=1, lt=12) @@ -39,12 +41,16 @@ class LoadLabwareRequestData(BaseModel): class LoadLabwareResponseData(BaseModel): + """Result field in an equipment.loadLabware command response.""" + labwareId: IdentifierType definition: LabwareDefinition calibration: OffsetVector class LoadInstrumentRequestData(BaseModel): + """Data field in an equipment.loadInstrument command request.""" + instrumentName: PipetteName = Field( ..., description="The name of the instrument model") @@ -52,6 +58,8 @@ class LoadInstrumentRequestData(BaseModel): class LoadInstrumentResponseData(BaseModel): + """Result field in an equipment.loadInstrument command response.""" + instrumentId: IdentifierType @@ -88,25 +96,8 @@ class SetHasCalibrationBlockRequestData(BaseModel): description="whether or not there is a calibration block present") -CommandDataType = typing.Union[ - SetHasCalibrationBlockRequestData, - JogPosition, - LiquidRequestData, - PipetteRequestDataBase, - LoadLabwareRequestData, - LoadInstrumentRequestData, - EmptyModel -] - -# A Union of all command result types -CommandResultType = typing.Union[ - LoadLabwareResponseData, - LoadInstrumentResponseData, -] - - class CommandStatus(str, Enum): - """The command status""" + """The command status.""" executed = "executed" queued = "queued" failed = "failed" @@ -121,7 +112,7 @@ class SessionCommandRequest( GenericModel, typing.Generic[CommandT, RequestDataT, ResponseDataT] ): - """A session command""" + """A session command request.""" command: CommandT = Field( ..., description="The command description") @@ -139,6 +130,7 @@ def make_response( completed_at: typing.Optional[datetime], result: typing.Optional[ResponseDataT] ) -> 'SessionCommandResponse[CommandT, RequestDataT, ResponseDataT]': + """Create a SessionCommandResponse object.""" return SessionCommandResponse( command=self.command, data=self.data, @@ -155,7 +147,7 @@ class SessionCommandResponse( GenericModel, typing.Generic[CommandT, RequestDataT, ResponseDataT] ): - """A session command response""" + """A session command response.""" command: CommandT data: RequestDataT status: CommandStatus @@ -165,7 +157,6 @@ class SessionCommandResponse( result: typing.Optional[ResponseDataT] = None -# The command definitions requiring no data and result types. CommandsEmptyData = Literal[ ProtocolCommand.start_run, ProtocolCommand.start_simulate, @@ -190,14 +181,14 @@ class SessionCommandResponse( CheckCalibrationCommand.return_tip, CheckCalibrationCommand.transition ] +"""The command definitions requiring no data and result types.""" -class SimpleCommandRequest( - SessionCommandRequest[CommandsEmptyData, - EmptyModel, - EmptyModel]): - """A command containing no data and result type""" - pass +SimpleCommandRequest = SessionCommandRequest[ + CommandsEmptyData, + EmptyModel, + EmptyModel] +"""A command request containing no data and result type.""" SimpleCommandResponse = SessionCommandResponse[ @@ -205,6 +196,7 @@ class SimpleCommandRequest( EmptyModel, EmptyModel ] +"""Response to :class:`~SimpleCommandRequest`""" LoadLabwareRequest = SessionCommandRequest[ @@ -289,8 +281,7 @@ class SimpleCommandRequest( SetHasCalibrationBlockResponse = SessionCommandResponse[ - Literal[ - CalibrationCommand.set_has_calibration_block], + Literal[CalibrationCommand.set_has_calibration_block], SetHasCalibrationBlockRequestData, EmptyModel] @@ -304,6 +295,7 @@ class SimpleCommandRequest( JogRequest, SetHasCalibrationBlockRequest, ] +"""Union of all request types""" ResponseTypes = typing.Union[ SimpleCommandResponse, @@ -314,11 +306,15 @@ class SimpleCommandRequest( JogResponse, SetHasCalibrationBlockResponse, ] +"""Union of all response types""" + -# Session command requests/responses CommandRequest = RequestModel[ RequestTypes ] +"""The command request model.""" + CommandResponse = ResponseModel[ ResponseTypes ] +"""The command response model."""