From 04545944c576e236a04f306de8802d45afdea173 Mon Sep 17 00:00:00 2001 From: Max Marrone Date: Mon, 22 Jul 2024 10:21:30 -0400 Subject: [PATCH] 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`. --- .../drivers/can_bus/settings.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hardware/opentrons_hardware/drivers/can_bus/settings.py b/hardware/opentrons_hardware/drivers/can_bus/settings.py index c36bd791fb9..9ebb990d9c9 100644 --- a/hardware/opentrons_hardware/drivers/can_bus/settings.py +++ b/hardware/opentrons_hardware/drivers/can_bus/settings.py @@ -50,21 +50,21 @@ class DriverSettings(BaseSettings): """Settings for driver building.""" interface: str = Field( - DEFAULT_INTERFACE, + default=DEFAULT_INTERFACE, description=f"Can either be {OPENTRONS_INTERFACE} for simple socket " f"or a python can interface.", ) bit_rate: int = Field( - DEFAULT_BITRATE, + default=DEFAULT_BITRATE, description=f"Bit rate. Not applicable to {OPENTRONS_INTERFACE} interface.", ) - channel: str = Field(DEFAULT_CHANNEL, description="The SocketCan channel.") + channel: str = Field(default=DEFAULT_CHANNEL, description="The SocketCan channel.") - host: str = Field(DEFAULT_HOST, description=f"{OPENTRONS_INTERFACE} only.") - port: int = Field(DEFAULT_PORT, description=f"{OPENTRONS_INTERFACE} only.") - fcan_clock: int = Field(DEFAULT_FDCAN_CLK, description="pcan only.") - sample_rate: float = Field(DEFAULT_SAMPLE_RATE, description="pcan only.") - jump_width: int = Field(DEFAULT_JUMP_WIDTH_SEG, descript="pcan only.") + host: str = Field(default=DEFAULT_HOST, description=f"{OPENTRONS_INTERFACE} only.") + port: int = Field(default=DEFAULT_PORT, description=f"{OPENTRONS_INTERFACE} only.") + fcan_clock: int = Field(default=DEFAULT_FDCAN_CLK, description="pcan only.") + sample_rate: float = Field(default=DEFAULT_SAMPLE_RATE, description="pcan only.") + jump_width: int = Field(default=DEFAULT_JUMP_WIDTH_SEG, description="pcan only.") class Config: # noqa: D106 env_prefix = "OT3_CAN_DRIVER_"