Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(api): Delete obsolete re-exports #17172

Open
wants to merge 4 commits into
base: edge
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions api/src/opentrons/protocol_api/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
from math import isinf, isnan
from typing_extensions import TypeGuard

from opentrons_shared_data.labware.labware_definition import LabwareRole
from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
LabwareRole,
)
from opentrons_shared_data.pipette.types import PipetteNameType
from opentrons_shared_data.robot.types import RobotType

from opentrons.protocols.api_support.types import APIVersion, ThermocyclerStep
from opentrons.protocols.api_support.util import APIVersionError
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocols.advanced_control.transfers.common import TransferTipPolicyV2
from opentrons.types import (
Mount,
Expand Down
6 changes: 3 additions & 3 deletions api/src/opentrons/protocol_engine/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
from enum import Enum
from typing import List, Optional, Union

from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.errors import EnumeratedError
from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.hardware_control.types import DoorState
from opentrons.hardware_control.modules import LiveData

from opentrons_shared_data.errors import EnumeratedError

from ..commands import (
Command,
CommandCreate,
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/execution/equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from dataclasses import dataclass
from typing import Optional, overload, Union

from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.pipette.types import PipetteNameType

from opentrons.calibration_storage.helpers import uri_from_details
from opentrons.protocols.models import LabwareDefinition
from opentrons.types import MountType
from opentrons.hardware_control import HardwareControlAPI
from opentrons.hardware_control.modules import (
Expand Down
17 changes: 9 additions & 8 deletions api/src/opentrons/protocol_engine/protocol_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
from contextlib import AsyncExitStack
from logging import getLogger
from typing import Dict, Optional, Union, AsyncGenerator, Callable
from opentrons.protocol_engine.actions.actions import (
ResumeFromRecoveryAction,
SetErrorRecoveryPolicyAction,
)

from opentrons.protocols.models import LabwareDefinition
from opentrons.hardware_control import HardwareControlAPI
from opentrons.hardware_control.modules import AbstractModule as HardwareModuleAPI
from opentrons.hardware_control.types import PauseType as HardwarePauseType
from opentrons_shared_data.errors import (
ErrorCodes,
EnumeratedError,
)
from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.hardware_control import HardwareControlAPI
from opentrons.hardware_control.modules import AbstractModule as HardwareModuleAPI
from opentrons.hardware_control.types import PauseType as HardwarePauseType

from .actions.actions import (
ResumeFromRecoveryAction,
SetErrorRecoveryPolicyAction,
)
from .errors import ProtocolCommandFailedError, ErrorOccurrence, CommandNotAllowedError
from .errors.exceptions import EStopActivatedError
from .error_recovery_policy import ErrorRecoveryPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DEFAULT_DECK_DEFINITION_VERSION,
)
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons.types import DeckSlotName

from ..types import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
import logging
from anyio import to_thread

from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.protocols.labware import get_labware_definition

# TODO (lc 09-26-2022) We should conditionally import ot2 or ot3 calibration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
"""Validation file for labware role and location checking functions."""

from opentrons_shared_data.labware.labware_definition import LabwareRole
from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
LabwareRole,
)


def is_flex_trash(load_name: str) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_engine/state/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@

from opentrons_shared_data.errors.exceptions import InvalidStoredData
from opentrons_shared_data.labware.constants import WELL_NAME_PATTERN
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.deck.types import CutoutFixture
from opentrons_shared_data.pipette import PIPETTE_X_SPAN
from opentrons_shared_data.pipette.types import ChannelCount
from opentrons.protocols.models import LabwareDefinition

from .. import errors
from ..errors import (
Expand Down
5 changes: 3 additions & 2 deletions api/src/opentrons/protocol_engine/state/labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons_shared_data.gripper.constants import LABWARE_GRIP_FORCE
from opentrons_shared_data.labware.labware_definition import (
LabwareRole,
InnerWellGeometry,
LabwareDefinition,
LabwareRole,
WellDefinition,
)
from opentrons_shared_data.pipette.types import LabwareUri

from opentrons.types import DeckSlotName, StagingSlotName, MountType
from opentrons.protocols.api_support.constants import OPENTRONS_NAMESPACE
from opentrons.protocols.models import LabwareDefinition, WellDefinition
from opentrons.calibration_storage.helpers import uri_from_details

from .. import errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import anyio

from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from .protocol_source import ProtocolFileRole, ProtocolSource, ProtocolType

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
)
from opentrons_shared_data.errors.exceptions import PythonException

from opentrons.protocols.models import JsonProtocol as JsonProtocolUpToV5
from opentrons.protocols.models.json_protocol import Model as JsonProtocolUpToV5

from .file_identifier import (
IdentifiedFile,
Expand Down
21 changes: 0 additions & 21 deletions api/src/opentrons/protocols/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +0,0 @@
# Convenience re-exports of models that are especially common or important.
# More detailed sub-models are always available through the underlying
# submodules.
#
# If re-exporting something, its name should still make sense when it's separated
# from the name of its parent submodule. e.g. re-exporting models.json_protocol.Labware
# as models.Labware could be confusing.

# TODO(mc, 2022-03-11): remove this re-export when it won't break pickling
# https://opentrons.atlassian.net/browse/RSS-94
from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
WellDefinition,
)
from .json_protocol import Model as JsonProtocol

__all__ = [
"LabwareDefinition",
"WellDefinition",
"JsonProtocol",
]
2 changes: 1 addition & 1 deletion api/tests/opentrons/protocol_api/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from opentrons.protocols.advanced_control.transfers.common import TransferTipPolicyV2
from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
LabwareRole,
Parameters as LabwareDefinitionParameters,
)
Expand All @@ -33,7 +34,6 @@
HeaterShakerModuleModel,
ThermocyclerStep,
)
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocols.api_support.types import APIVersion
from opentrons.protocols.api_support.util import APIVersionError
from opentrons.protocol_api import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
import pytest
from decoy import Decoy

from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.types import DeckSlotName
from opentrons.protocols.models import LabwareDefinition

from opentrons.protocol_engine.errors import (
LabwareIsNotAllowedInLocationError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import pytest
from decoy import Decoy, matchers

from opentrons_shared_data.labware.labware_definition import Parameters, Dimensions
from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
Parameters,
Dimensions,
)
from opentrons_shared_data.errors.exceptions import (
EnumeratedError,
FailedGripperPickupError,
Expand All @@ -18,7 +22,6 @@

from opentrons.protocol_engine.state import update_types
from opentrons.types import DeckSlotName, Point
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocol_engine import errors, Config
from opentrons.protocol_engine.resources import labware_validation
from opentrons.protocol_engine.resources.model_utils import ModelUtils
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
"""Test load labware commands."""
import inspect
from opentrons.protocol_engine.state.update_types import (
LabwareLocationUpdate,
StateUpdate,
)
import pytest

import pytest
from decoy import Decoy

from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.types import DeckSlotName
from opentrons.protocols.models import LabwareDefinition

from opentrons.protocol_engine.errors import (
LabwareNotLoadedError,
Expand All @@ -21,6 +18,10 @@
from opentrons.protocol_engine.execution import ReloadedLabwareData, EquipmentHandler
from opentrons.protocol_engine.resources import labware_validation
from opentrons.protocol_engine.state.state import StateView
from opentrons.protocol_engine.state.update_types import (
LabwareLocationUpdate,
StateUpdate,
)

from opentrons.protocol_engine.commands.command import SuccessData
from opentrons.protocol_engine.commands.reload_labware import (
Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/protocol_engine/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from opentrons_shared_data.deck import load as load_deck
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons_shared_data.labware import load_definition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.pipette import pipette_definition
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocols.api_support.deck_type import (
STANDARD_OT2_DECK,
SHORT_TRASH_DECK,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from opentrons_shared_data.pipette.types import PipetteNameType
from opentrons_shared_data.pipette import pipette_definition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.labware.types import LabwareUri

from opentrons.calibration_storage.helpers import uri_from_details
Expand All @@ -21,7 +22,6 @@
AbstractModule,
)
from opentrons.hardware_control.dev_types import PipetteDict
from opentrons.protocols.models import LabwareDefinition

from opentrons.protocol_engine import errors
from opentrons.protocol_engine.types import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from opentrons.hardware_control.types import TipStateType
from opentrons.hardware_control.protocols.types import OT2RobotType, FlexRobotType

from opentrons.protocols.models import LabwareDefinition
from opentrons.protocol_engine.state.state import StateView
from opentrons.protocol_engine.types import TipGeometry, TipPresenceStatus
from opentrons.protocol_engine.resources import LabwareDataProvider
Expand All @@ -20,6 +19,7 @@
CommandPreconditionViolated,
CommandParameterLimitViolated,
)
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons.protocol_engine.execution.tip_handler import (
HardwareTipHandler,
VirtualTipHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from decoy import Decoy

from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons.types import DeckSlotName

from opentrons.protocol_engine.types import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Functional tests for the LabwareDataProvider."""
from typing import cast

from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.labware.types import LabwareDefinition as LabwareDefDict
from opentrons.calibration_storage.helpers import hash_labware_def
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocol_api.labware import get_labware_definition

from opentrons.protocol_engine.resources import LabwareDataProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import pytest

from opentrons_shared_data.labware.labware_definition import (
LabwareDefinition,
LabwareRole,
OverlapOffset,
Parameters,
)
from opentrons.protocols.models import LabwareDefinition

from opentrons.protocol_engine.resources import labware_validation as subject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from pydantic import BaseModel
from typing import Optional, cast, Dict

from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.pipette.types import PipetteNameType
from opentrons.types import MountType
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocol_engine import ErrorOccurrence, commands as cmd
from opentrons.protocol_engine.types import (
DeckPoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons_shared_data.deck import load as load_deck
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.labware.types import LabwareUri
from opentrons_shared_data.pipette import pipette_definition
from opentrons.calibration_storage.helpers import uri_from_details
from opentrons.protocols.models import LabwareDefinition
from opentrons.types import Point, DeckSlotName, MountType, StagingSlotName
from opentrons_shared_data.pipette.types import PipetteNameType
from opentrons_shared_data.labware.labware_definition import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from opentrons.calibration_storage.helpers import uri_from_details
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons.protocols.models import LabwareDefinition
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons.types import DeckSlotName

from opentrons.protocol_engine.types import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from opentrons_shared_data.labware import load_definition
from opentrons_shared_data.labware.labware_definition import (
Parameters,
LabwareDefinition,
LabwareRole,
OverlapOffset as SharedDataOverlapOffset,
GripperOffsets,
Expand All @@ -25,7 +26,6 @@
STANDARD_OT2_DECK,
STANDARD_OT3_DECK,
)
from opentrons.protocols.models import LabwareDefinition
from opentrons.types import DeckSlotName, MountType

from opentrons.protocol_engine import errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import pytest
from pytest_lazyfixture import lazy_fixture # type: ignore[import-untyped]

from opentrons_shared_data.deck import load as load_deck
from opentrons_shared_data.deck.types import DeckDefinitionV5
from opentrons_shared_data.labware.labware_definition import LabwareDefinition
from opentrons_shared_data.robot.types import RobotType
from opentrons_shared_data.deck import load as load_deck

from opentrons.calibration_storage.helpers import uri_from_details
from opentrons.hardware_control import API as HardwareAPI
from opentrons.hardware_control.types import DoorState
from opentrons.protocols.models import LabwareDefinition
from opentrons.protocol_engine import (
ProtocolEngine,
Config as EngineConfig,
Expand Down
Loading
Loading