quilt_knit.swatch.wale_boundary_instructions module

Module containing structure that define horizontal boundary instructions.

class Wale_Side(*args)[source]

Bases: Swatch_Side, Enum

Enumeration of the wale-wise side of a swatch an instruction exists on. Used to differentiate between entrance-exit seam directions.

Parameters:

args (tuple)

Top = 'Top'
Bottom = 'Bottom'
__str__()[source]
Returns:

The name of this wale side.

Return type:

(str)

__repr__()[source]
Returns:

The name of this wale side.

Return type:

(str)

property opposite: Wale_Side

Returns: Wale_Side: The opposite of this wale side.

__invert__()[source]
Returns:

The opposite of this wale side.

Return type:

Wale_Side

__neg__()[source]
Returns:

The opposite of this wale side.

Return type:

Wale_Side

__init__(*args)
Parameters:

args (tuple)

__hash__()
Returns:

The hash value of the name of this Swatch Side

Return type:

int

classmethod __contains__(member)

Return True if member is a member of this enum raises TypeError if member is not an enum member

note: in 3.12 TypeError will no longer be raised, and True will also be returned if member is the value of a member in this enum

classmethod __getitem__(name)

Return the member matching name.

classmethod __iter__()

Return members in definition order.

classmethod __len__()

Return the number of members (no aliases)

class Wale_Boundary_Instruction(instruction, source_swatch_name, is_entrance, is_exit, _connections_made=0)[source]

Bases: Swatch_Boundary_Instruction

A class that represent instructions that process loops on the wale-wise boundary of a swatch program

Parameters:
  • instruction (Needle_Instruction)

  • source_swatch_name (str)

  • is_entrance (bool)

  • is_exit (bool)

  • _connections_made (int)

is_entrance: bool
is_exit: bool
property connections_made: int

Returns: int: The number of reported connections made to this boundary instruction.

add_connection()[source]

Increments the number of connections available to this boundary instruction.

Return type:

None

property swatch_side: Wale_Side

Returns: Wale_Side: The side of the wale this instruction belongs to base don if it is an entrance or an exit.

property entrance_needle: Needle

Returns: Needle: The needle that the instruction enters.

property exit_needle: None | Needle | tuple[Needle, Needle]

Returns: None | Needle | tuple[Needle, Needle]: The needle or needles (split) that loops are left on after the instruction is executed. None if the instruction drops the loops.

property front_needle: None | Needle

Returns: None | Needle: The front needle involved in this instruction or None if it does not involve a front bed needle.

property back_needle: None | Needle

Returns: None | Needle: The back needle involved in this instruction or None if it does not involve a back bed needle.

property two_needle_exit: bool

Returns: bool: True if an exit instruction that splits, leaving loops on two needles. False, otherwise.

property entrance_requires_loop: bool

Returns: bool: True if this is an entrance instruction that requires an input loop at the operating needle. False, otherwise.

property enters_front_needle: bool

Returns: bool: True if this is an entrance instruction that must align a front bed needle to form a connection. False, otherwise.

property exits_front_needle: bool

Returns: bool: True if this is an exit instruction that leaves loops on a front needle. False, otherwise.

property enters_back_needle: bool

Returns: bool: True if this is an entrance instruction that must align a back bed needle to form a connection. False, otherwise.

property exits_back_needle: bool

Returns: bool: True if this is an exit instruction that leaves loops on a back needle. False, otherwise.

property requires_entrance_connection: bool

Returns: bool: True if this is an entrance instruction that must be connected (not a tuck). False, otherwise.

property required_exit_connections: int

Returns: int: The number of connections required to satisfy this exit instruction. * 0 if this is not an exit or if the exit drops loops. * 1 if this exit leaves loops on one needle. * 2 if this exit leaves loops on two needles (split).

property is_top: bool

Returns: bool: True if this instruction is on the top boundary of the swatch. False, otherwise.

property is_bottom: bool

Returns: bool: True if this instruction is on the bottom boundary of the swatch. False, otherwise.

__str__()[source]
Returns:

A string representation of the connection requirements and direction into this instruction.

Return type:

str

__repr__()[source]
Returns:

A string representation of the connection requirements and direction into this instruction.

Return type:

str

__init__(instruction, source_swatch_name, is_entrance, is_exit, _connections_made=0)
Parameters:
  • instruction (Needle_Instruction)

  • source_swatch_name (str)

  • is_entrance (bool)

  • is_exit (bool)

  • _connections_made (int)

__lt__(other)
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

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 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.

property needle: Needle

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

instruction: Needle_Instruction
source_swatch_name: str