Skip to content

Commit

Permalink
Work around circular dependency in opentrons.config.types.
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed May 16, 2024
1 parent cab25c6 commit 3651f5e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions api/src/opentrons/config/types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from enum import Enum
from dataclasses import dataclass, asdict, fields
from typing import Dict, Tuple, TypeVar, Generic, List, cast, Optional
from typing import Dict, Tuple, TypeVar, Generic, List, cast, Optional, TYPE_CHECKING
from typing_extensions import TypedDict, Literal
from opentrons.hardware_control.types import OT3AxisKind, InstrumentProbeType

if TYPE_CHECKING:
# Work around circular import.
from opentrons.hardware_control.types import OT3AxisKind, InstrumentProbeType


class AxisDict(TypedDict):
Expand Down Expand Up @@ -31,7 +34,7 @@ def __getitem__(self, key: GantryLoad) -> Vt:
return cast(Vt, asdict(self)[key.value])


PerPipetteAxisSettings = ByGantryLoad[Dict[OT3AxisKind, float]]
PerPipetteAxisSettings = ByGantryLoad[Dict["OT3AxisKind", float]]


class CurrentDictDefault(TypedDict):
Expand Down Expand Up @@ -82,7 +85,7 @@ class OT3MotionSettings:

def by_gantry_load(
self, gantry_load: GantryLoad
) -> Dict[str, Dict[OT3AxisKind, float]]:
) -> Dict[str, Dict["OT3AxisKind", float]]:
return dict(
(field.name, getattr(self, field.name)[gantry_load])
for field in fields(self)
Expand All @@ -96,7 +99,7 @@ class OT3CurrentSettings:

def by_gantry_load(
self, gantry_load: GantryLoad
) -> Dict[str, Dict[OT3AxisKind, float]]:
) -> Dict[str, Dict["OT3AxisKind", float]]:
return dict(
(field.name, getattr(self, field.name)[gantry_load])
for field in fields(self)
Expand Down Expand Up @@ -139,7 +142,7 @@ class LiquidProbeSettings:
aspirate_while_sensing: bool
auto_zero_sensor: bool
num_baseline_reads: int
data_files: Optional[Dict[InstrumentProbeType, str]]
data_files: Optional[Dict["InstrumentProbeType", str]]


@dataclass(frozen=True)
Expand Down

0 comments on commit 3651f5e

Please sign in to comment.