Description
After consolidating instructions, convert them to dataclasses for cleaner definitions and automatic __init__, __repr__, etc.
Current Pattern
class InstructionPoint(_BaseInstruction):
def __init__(self, feed_rate: float, x: float, y: float):
self.x = x
self.y = y
self.feed_rate = feed_rate
if x is None or y is None:
raise ValueError("Point requires an X or Y")
def __str__(self) -> str:
return f"Point: ({self.x}, {self.y})"
def to_g_code(self) -> str:
return f"G1 X{self.x:.3f} Y{self.y:.3f} F{self.feed_rate}"
Proposed Pattern
@dataclass
class PointInstruction(Instruction):
x: float
y: float
feed_rate: float
def __post_init__(self) -> None:
if self.x is None or self.y is None:
raise ValueError("Point requires an X and Y")
def to_g_code(self) -> str:
return f"G1 X{self.x:.3f} Y{self.y:.3f} F{self.feed_rate}"
Acceptance Criteria
Dependencies
Description
After consolidating instructions, convert them to dataclasses for cleaner definitions and automatic
__init__,__repr__, etc.Current Pattern
Proposed Pattern
Acceptance Criteria
__str__methods where not needed__post_init__where applicableDependencies