# knitout_interpreter.knitout_operations.knitout_instruction module

Structure for Instructions

class knitout_interpreter.knitout_operations.knitout_instruction.Knitout_Instruction_Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

  Bases: `Enum`

  Enumeration of knitout instruction types.

  In = 'in'
  Inhook = 'inhook'
  Releasehook = 'releasehook'
  Out = 'out'
  Outhook = 'outhook'
  Stitch = 'stitch'
  Rack = 'rack'
  Knit = 'knit'
  Tuck = 'tuck'
  Split = 'split'
  Drop = 'drop'
  Xfer = 'xfer'
  Miss = 'miss'
  Kick = 'kick'
  Pause = 'pause'
  static get_instruction(inst_str)

    Get the instruction type from a string.

    Parameters:

      inst_str (str) – Instruction string to convert.

    Returns:

      The corresponding Knitout_Instruction_Type enum value.

    Return type:

      Knitout_Instruction_Type

  property is_carrier_instruction: bool

    Check if instruction operates on yarn carriers.

    Returns:

      True if instruction operates on yarn carriers.

  property is_needle_instruction: bool

    Check if instruction operates on needles.

    Returns:

      True if operation operates on needles.

  property in_knitting_pass: bool

    Check if instruction can be done in a knit pass.

    Returns:

      True if instruction can be done in a knit pass.

  property all_needle_instruction: bool

    Check if instruction is compatible with all-needle knitting.

    Returns:

      True if instruction is compatible with all-needle knitting.

  property directed_pass: bool

    Check if instruction requires a direction.

    Returns:

      True if instruction requires a direction.

  property requires_carrier: bool

    Check if instruction requires a carrier.

    Returns:

      True if instruction requires a carrier.

  property requires_second_needle: bool

    Check if instruction requires a second needle.

    Returns:

      True if instruction requires a second needle.

  property allow_sliders: bool

    Check if this is a transfer instruction that can operate on sliders.

    Returns:

      True if this is a transfer instruction that can operate on sliders.

  compatible_pass(other_instruction)

    Determine if instruction can share a machine pass with another instruction.

    Parameters:

      other_instruction (Knitout_Instruction_Type) – The other instruction to check compatibility with.

    Returns:

      True if both instructions could be executed in the same pass.

    Return type:

      bool

class knitout_interpreter.knitout_operations.knitout_instruction.Knitout_Instruction(instruction_type, comment, interrupts_carriage_pass=True)

  Bases: `Knitout_Line`

  Superclass for knitout operations.

  execute(machine_state)

    Execute the instruction on the machine state.

    Parameters:

      machine_state (Knitting_Machine) – The machine state to update.

    Returns:

      True if the process completes an update.

    Return type:

      bool