knitout_interpreter.knitout_operations.Pause_Instruction module
Module for the Pause Knitting Machine Instruction
- class Pause_Instruction(*args, **kwargs)[source]
Bases:
Knitout_InstructionInstruction for pausing the knitting machine.
- instruction_type: ClassVar[Knitout_Instruction_Type] = 'pause'
- __init__(comment=None)[source]
Initialize a pause instruction.
- Parameters:
comment (None | str) – Optional comment for the pause instruction.
- will_update_machine_state(machine_state)[source]
- Parameters:
machine_state (Knitting_Machine) – The machine state to test if this instruction will update it.
- Returns:
Always False because pause instructions don’t update the machine state.
- Return type:
- execute(machine_state)[source]
Execute the pause instruction.
- Parameters:
machine_state (Knitout_Knitting_Machine) – The machine state (not modified by pause).
- Returns:
False as no update is caused by pauses.
- Return type:
- __hash__()
- Returns:
Unique integer based on the time that this instruction was created in the execution.
- Return type:
- classmethod __init_subclass__(**kwargs)
Automatically wrap execute() method in all subclasses.
- static __new__(cls, *args, **kwargs)
Counts the number of knitout lines created while running a program. Ensures a unique identifier for each knitout line.
- property comment_str: str
Get the comment as a formatted string.
- Returns:
The comment formatted as a string with appropriate formatting.
- property follow_comments: list[Knitout_Comment_Line]
Returns: list[Knitout_Comment_Line]: A list of Knitout_Comment_Line objects that follow this line.
- property has_comment: bool
Check if this line has a comment.
- Returns:
True if comment is present. False, otherwise.
- Return type:
- property has_line_number: bool
Returns: bool: True if the original line number of this knitout line has been set.
- id_str()
Get string representation with original line number if present.
- Returns:
String with original line number added if present.
- Return type:
- property original_line_number: int
Returns: int: The original position of this line from the program it was parsed from.
- set_line(line_number, source=None)
Set the line number of this instruction. If this is the first time that the instruction’s line was set, the value will become the original line number.