quilt_knit.swatch.swatch_boundary_instruction module

Module defining the abstract base class for swatch boundary instructions.

class Swatch_Boundary_Instruction(instruction, source_swatch_name)[source]

Bases: object

A class to represent instructions on the boundary of a swatch program.

Parameters:
  • instruction (Needle_Instruction)

  • source_swatch_name (str)

instruction: Needle_Instruction
source_swatch_name: str
property carrier_set: Yarn_Carrier_Set | None

Returns: Yarn_Carrier_Set | None: The carrier set of this boundary instruction or None if the instruction does not use a carrier set.

property needle: Needle

Returns: Needle: The needle that is activated by this boundary instruction.

property direction: Carriage_Pass_Direction | None

Returns: Carriage_Pass_Direction | None: The direction this instruction forms a loop or None if xfer instruction.

property instruction_index: int | None

Returns: int | None: Index of the instruction in the original swatch program. None if the instruction does have a line number defined.

__repr__()[source]
Returns:

A string representing this boundary instruction.

Return type:

str

__str__()[source]
Returns:

The string representation of this boundary instruction.

Return type:

str

__lt__(other)[source]
Parameters:

other (Needle | Needle_Instruction | Swatch_Boundary_Instruction) – The needle or instruction containing a needle to sort these instructions leftward and rightward.

Returns:

True if this instruction is on a needle left of the other needle. False, otherwise.

Return type:

bool

__init__(instruction, source_swatch_name)
Parameters:
  • instruction (Needle_Instruction)

  • source_swatch_name (str)