knitout_interpreter.knitout_operations.Knitout_Line module — knitout-interpreter 0.0.18 documentation

# knitout_interpreter.knitout_operations.Knitout_Line module

Base class for Knitout Lines of code

class knitout_interpreter.knitout_operations.Knitout_Line.Knitout_Line(comment, interrupts_carriage_pass=False)

  Bases: `object`

  General class for lines of knitout.

  property interrupts_carriage_pass: bool

    Check if this line interrupts a carriage pass.

    Returns:

      True if this type of line interrupts a carriage pass, False if it is only used for comments or setting information.

  add_follow_comment(comment_line)

    Add a comment line to comments that follow this line.

    Parameters:

      comment_line (str) – The comment text to add.

  property has_comment: bool

    Check if this line has a comment.

    Returns:

      True if comment is present.

  property comment_str: str

    Get the comment as a formatted string.

    Returns:

      The comment formatted as a string with appropriate formatting.

  execute(machine_state)

    Execute the instruction on the machine state.

    Parameters:

      machine_state (Knitting_Machine) – The knitting machine state to update.

    Returns:

      True if the process completes an update.

    Return type:

      bool

  property injected: bool

    Check if instruction was marked as injected.

    Returns:

      True if instruction was marked as injected by a negative line number.

  id_str()

    Get string representation with original line number if present.

    Returns:

      String with original line number added if present.

    Return type:

      str

class knitout_interpreter.knitout_operations.Knitout_Line.Knitout_Version_Line(version=2, comment=None)

  Bases: `Knitout_Line`

  Represents a knitout version specification line.

class knitout_interpreter.knitout_operations.Knitout_Line.Knitout_Comment_Line(comment)

  Bases: `Knitout_Line`

  Represents a comment line in knitout.

  execute(machine_state)

    Execute the instruction on the machine state.

    Parameters:

      machine_state (Knitting_Machine) – The knitting machine state to update.

    Returns:

      True if the process completes an update.

    Return type:

      bool