Skip to content

Commit

Permalink
refactor(api): Rename opentrons.commands to opentrons.legacy_commands (
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring authored and Carlos-fernandez committed May 20, 2024
1 parent 382d087 commit 6f3ca4a
Show file tree
Hide file tree
Showing 26 changed files with 43 additions and 29 deletions.
4 changes: 2 additions & 2 deletions api/.flake8
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ per-file-ignores =
src/opentrons/simulate.py:ANN,D
src/opentrons/types.py:ANN,D
src/opentrons/calibration_storage/*:ANN,D
src/opentrons/commands/*:D
src/opentrons/legacy_commands/*:D
src/opentrons/config/*:ANN,D
src/opentrons/drivers/*:ANN,D
src/opentrons/hardware_control/*:ANN,D
Expand All @@ -51,7 +51,7 @@ per-file-ignores =
tests/opentrons/test_types.py:ANN,D
tests/opentrons/conftest.py:ANN,D
tests/opentrons/calibration_storage/*:ANN,D
tests/opentrons/commands/*:ANN,D
tests/opentrons/legacy_commands/*:ANN,D
tests/opentrons/config/*:ANN,D
tests/opentrons/data/*:ANN,D
tests/opentrons/drivers/*:ANN,D
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

from opentrons import protocol_api, __version__, should_use_ot3

from opentrons.commands import types as command_types
from opentrons.legacy_commands import types as command_types

from opentrons.hardware_control import (
API as OT2API,
Expand Down Expand Up @@ -333,7 +333,7 @@ def execute( # noqa: C901
'text': string_command_text,
# The rest of this struct is
# command-dependent; see
# opentrons.commands.commands.
# opentrons.legacy_commands.commands.
}
}
Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/legacy_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from typing import Callable, Dict, List
from typing_extensions import Literal

from opentrons.commands import types
from opentrons.legacy_commands import types


MODULE_LOG = logging.getLogger(__name__)
Expand All @@ -16,7 +16,7 @@ class LegacyBroker:
Deprecated:
Use the newer, more generic `opentrons.utils.Broker` class instead.
This class is coupled to old types from `opentrons.commands`.
This class is coupled to old types from `opentrons.legacy_commands`.
https://opentrons.atlassian.net/browse/RSS-270
"""

Expand Down
1 change: 1 addition & 0 deletions api/src/opentrons/legacy_commands/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Command models from before v5.0, before Protocol Engine."""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/instrument_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
from opentrons.legacy_broker import LegacyBroker
from opentrons.hardware_control.dev_types import PipetteDict
from opentrons import types
from opentrons.commands import commands as cmds
from opentrons.legacy_commands import commands as cmds

from opentrons.commands import publisher
from opentrons.legacy_commands import publisher
from opentrons.protocols.advanced_control.mix import mix_from_kwargs
from opentrons.protocols.advanced_control import transfers

Expand Down
4 changes: 2 additions & 2 deletions api/src/opentrons/protocol_api/module_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from opentrons.legacy_broker import LegacyBroker
from opentrons.hardware_control.modules import ThermocyclerStep
from opentrons.commands import module_commands as cmds
from opentrons.commands.publisher import CommandPublisher, publish
from opentrons.legacy_commands import module_commands as cmds
from opentrons.legacy_commands.publisher import CommandPublisher, publish
from opentrons.protocols.api_support.types import APIVersion
from opentrons.protocols.api_support.util import APIVersionError, requires_version

Expand Down
10 changes: 7 additions & 3 deletions api/src/opentrons/protocol_api/protocol_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
from opentrons.legacy_broker import LegacyBroker
from opentrons.hardware_control import SyncHardwareAPI
from opentrons.hardware_control.modules.types import MagneticBlockModel
from opentrons.commands import protocol_commands as cmds, types as cmd_types
from opentrons.commands.helpers import stringify_labware_movement_command
from opentrons.commands.publisher import CommandPublisher, publish, publish_context
from opentrons.legacy_commands import protocol_commands as cmds, types as cmd_types
from opentrons.legacy_commands.helpers import stringify_labware_movement_command
from opentrons.legacy_commands.publisher import (
CommandPublisher,
publish,
publish_context,
)
from opentrons.protocols.api_support import instrument as instrument_support
from opentrons.protocols.api_support.deck_type import (
NoTrashDefinedError,
Expand Down
4 changes: 3 additions & 1 deletion api/src/opentrons/protocol_engine/clients/sync_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
from opentrons_shared_data.labware.dev_types import LabwareUri
from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from opentrons.commands.protocol_commands import comment as make_legacy_comment_command
from opentrons.legacy_commands.protocol_commands import (
comment as make_legacy_comment_command,
)
from opentrons.types import MountType
from opentrons.hardware_control.modules.types import ThermocyclerStep

Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_runner/legacy_command_mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from opentrons_shared_data.pipette.dev_types import PipetteNameType
from opentrons.types import MountType, DeckSlotName, Location
from opentrons.commands import types as legacy_command_types
from opentrons.legacy_commands import types as legacy_command_types
from opentrons.protocol_engine import (
ProtocolEngineError,
actions as pe_actions,
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocol_runner/legacy_context_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from contextlib import ExitStack
from typing import List, Optional

from opentrons.commands.types import CommandMessage as LegacyCommand
from opentrons.legacy_commands.types import CommandMessage as LegacyCommand
from opentrons.legacy_broker import LegacyBroker
from opentrons.protocol_engine import AbstractPlugin, actions as pe_actions
from opentrons.util.broker import ReadOnlyBroker
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/protocols/duration/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from dataclasses import dataclass

from opentrons.commands import types
from opentrons.legacy_commands import types
from opentrons.protocols.api_support.deck_type import (
guess_from_global_config as guess_deck_type_from_global_config,
)
Expand Down
6 changes: 3 additions & 3 deletions api/src/opentrons/simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
from opentrons.legacy_broker import LegacyBroker
from opentrons.config import IS_ROBOT
from opentrons import protocol_api
from opentrons.commands import types as command_types
from opentrons.legacy_commands import types as command_types

from opentrons.protocols import parse, bundle
from opentrons.protocols.types import (
Expand Down Expand Up @@ -114,7 +114,7 @@


# TODO(mm, 2023-10-05): Type _SimulateResultRunLog more precisely by using TypedDicts from
# opentrons.commands.
# opentrons.legacy_commands.
_SimulateResultRunLog = List[Mapping[str, Any]]
_SimulateResult = Tuple[_SimulateResultRunLog, Optional[BundleContents]]

Expand Down Expand Up @@ -453,7 +453,7 @@ def simulate(
- ``payload``: The command. The human-readable run log text is available at
``payload["text"]``. The other keys of ``payload`` are command-dependent;
see ``opentrons.commands``.
see ``opentrons.legacy_commands``.
.. note::
In older software versions, ``payload["text"]`` was a
Expand Down
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from opentrons.commands import protocol_commands
from opentrons.legacy_commands import protocol_commands


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
"""Tests for opentrons.commands.publisher."""
"""Tests for opentrons.legacy_commands.publisher."""
from __future__ import annotations

import pytest
from decoy import Decoy, matchers
from typing import Any, Dict, cast
from opentrons.legacy_broker import LegacyBroker
from opentrons.commands.types import Command as CommandDict, CommandMessage
from opentrons.commands.publisher import CommandPublisher, publish, publish_context
from opentrons.legacy_commands.types import Command as CommandDict, CommandMessage
from opentrons.legacy_commands.publisher import (
CommandPublisher,
publish,
publish_context,
)


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from decoy import matchers, Decoy

from opentrons.hardware_control.dev_types import PipetteDict
from opentrons.commands.types import CommentMessage, PauseMessage, CommandMessage
from opentrons.legacy_commands.types import CommentMessage, PauseMessage, CommandMessage
from opentrons.protocol_engine import (
DeckSlotLocation,
ModuleLocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
from datetime import datetime
from typing import Callable

from opentrons.commands.types import CommandMessage as LegacyCommand, PauseMessage
from opentrons.legacy_commands.types import (
CommandMessage as LegacyCommand,
PauseMessage,
)
from opentrons.protocol_engine import (
StateView,
actions as pe_actions,
Expand Down
2 changes: 1 addition & 1 deletion api/tests/opentrons/protocols/duration/test_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import math
import pytest

from opentrons.commands import types
from opentrons.legacy_commands import types
from opentrons.protocol_api import InstrumentContext
from opentrons.protocols.duration.estimator import (
DurationEstimator,
Expand Down
4 changes: 2 additions & 2 deletions api/tests/opentrons/test_legacy_broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from typing import List, NamedTuple, cast

from opentrons.commands.types import CommandMessage
from opentrons.commands.publisher import CommandPublisher, publish
from opentrons.legacy_commands.types import CommandMessage
from opentrons.legacy_commands.publisher import CommandPublisher, publish


def _my_command(arg1: int, arg2: str = "", arg3: str = "") -> CommandMessage:
Expand Down

0 comments on commit 6f3ca4a

Please sign in to comment.