Source code for knitout_interpreter.knitout_operations.Pause_Instruction

"""Module for the Pause Knitting Machine Instruction"""

from __future__ import annotations

from typing import ClassVar

from virtual_knitting_machine.Knitting_Machine import Knitting_Machine

from knitout_interpreter.knitout_execution_structures.Knitout_Knitting_Machine import Knitout_Knitting_Machine
from knitout_interpreter.knitout_operations.knitout_instruction import Knitout_Instruction, Knitout_Instruction_Type


[docs] class Pause_Instruction(Knitout_Instruction): """Instruction for pausing the knitting machine.""" instruction_type: ClassVar[Knitout_Instruction_Type] = Knitout_Instruction_Type.Pause
[docs] def __init__(self, comment: None | str = None): """Initialize a pause instruction. Args: comment: Optional comment for the pause instruction. """ super().__init__(comment)
[docs] def will_update_machine_state(self, machine_state: Knitting_Machine) -> bool: """ Args: machine_state (Knitting_Machine): The machine state to test if this instruction will update it. Returns: bool: Always False because pause instructions don't update the machine state. """ return False
[docs] def execute(self, machine_state: Knitout_Knitting_Machine) -> bool: """Execute the pause instruction. Args: machine_state: The machine state (not modified by pause). Returns: False as no update is caused by pauses. """ return False # No Update caused by pauses