Skip to content

Commit

Permalink
Work around "Missing named argument" errors.
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
SyntaxColoring committed Jul 22, 2024
1 parent b56a505 commit 0454594
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions hardware/opentrons_hardware/drivers/can_bus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_"
Expand Down

0 comments on commit 0454594

Please sign in to comment.