Skip to content

Commit 0454594

Browse files
Work around "Missing named argument" errors.
Something about the Pydantic upgrade was interacting poorly with Mypy. Despite these fields having defaults, Mypy was raising errors when the class was instantiated without them. Somehow, declaring the defaults as keyword arguments instead of positional arguments fixes it. Also fix a typo, `descript` -> `description`.
1 parent b56a505 commit 0454594

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

hardware/opentrons_hardware/drivers/can_bus/settings.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,21 @@ class DriverSettings(BaseSettings):
5050
"""Settings for driver building."""
5151

5252
interface: str = Field(
53-
DEFAULT_INTERFACE,
53+
default=DEFAULT_INTERFACE,
5454
description=f"Can either be {OPENTRONS_INTERFACE} for simple socket "
5555
f"or a python can interface.",
5656
)
5757
bit_rate: int = Field(
58-
DEFAULT_BITRATE,
58+
default=DEFAULT_BITRATE,
5959
description=f"Bit rate. Not applicable to {OPENTRONS_INTERFACE} interface.",
6060
)
61-
channel: str = Field(DEFAULT_CHANNEL, description="The SocketCan channel.")
61+
channel: str = Field(default=DEFAULT_CHANNEL, description="The SocketCan channel.")
6262

63-
host: str = Field(DEFAULT_HOST, description=f"{OPENTRONS_INTERFACE} only.")
64-
port: int = Field(DEFAULT_PORT, description=f"{OPENTRONS_INTERFACE} only.")
65-
fcan_clock: int = Field(DEFAULT_FDCAN_CLK, description="pcan only.")
66-
sample_rate: float = Field(DEFAULT_SAMPLE_RATE, description="pcan only.")
67-
jump_width: int = Field(DEFAULT_JUMP_WIDTH_SEG, descript="pcan only.")
63+
host: str = Field(default=DEFAULT_HOST, description=f"{OPENTRONS_INTERFACE} only.")
64+
port: int = Field(default=DEFAULT_PORT, description=f"{OPENTRONS_INTERFACE} only.")
65+
fcan_clock: int = Field(default=DEFAULT_FDCAN_CLK, description="pcan only.")
66+
sample_rate: float = Field(default=DEFAULT_SAMPLE_RATE, description="pcan only.")
67+
jump_width: int = Field(default=DEFAULT_JUMP_WIDTH_SEG, description="pcan only.")
6868

6969
class Config: # noqa: D106
7070
env_prefix = "OT3_CAN_DRIVER_"

0 commit comments

Comments
 (0)