quilt_knit.swatch.course_boundary_instructions module

Module containing structure that define course-wise boundary instructions of swatch programs.

class Course_Side(*args)[source]

Bases: Swatch_Side, Enum

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

Parameters:

args (tuple)

Left = 'Left'
Right = 'Right'
static entrance_by_direction(direction)[source]
Parameters:

direction (Carriage_Pass_Direction) – The direction of a carriage pass to find the entrance side of a course.

Returns:

The side of the course that would be entered by the given carriage pass direction

Return type:

Course_Side

static exit_by_direction(direction)[source]
Parameters:

direction (Carriage_Pass_Direction) – The direction of a carriage pass to find the exit side of a course.

Returns:

The side of the course that would be exited by the given carriage pass direction

Return type:

Course_Side

__str__()[source]
Returns:

The name of this course side.

Return type:

(str)

__repr__()[source]
Returns:

The name of this course side.

Return type:

(str)

property opposite: Course_Side

Returns: Course_Side: The opposite of this course side.

__invert__()[source]
Returns:

The opposite of this course side.

Return type:

Course_Side

__neg__()[source]
Returns:

The opposite of this course side.

Return type:

Course_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 Course_Boundary_Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumeration of the course-wise boundary entrance/exit types.

exit_boundary = 'exit'
entrance = 'entrance'
entrance_exit = 'entrance-exit'
blocked = 'blocked'
is_exit()[source]
Return type:

bool

Returns:

True if the boundary is an exit. False, otherwise.

is_entrance()[source]
Return type:

bool

Returns:

True if the boundary is an entrance. False, otherwise.

__str__()[source]
Returns:

The name of this boundary type.

Return type:

(str)

__repr__()[source]
Returns:

The name of this boundary type.

Return type:

(str)

__hash__()[source]
Returns:

The hash value of the name of this boundary type

Return type:

int

property opposite: Course_Boundary_Type

Returns: Course_Boundary_Type: The opposite of this boundary type. Entrance-Exits and blocked boundaries remain unchanged.

__invert__()[source]
Returns:

The opposite of this boundary type.

Return type:

Course_Boundary_Type

__neg__()[source]
Returns:

The opposite of this boundary type.

Return type:

Course_Boundary_Type

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 Course_Boundary_Instruction(instruction, source_swatch_name, left_boundary_type, right_boundary_type, carriage_pass_rack, carriage_pass_is_all_needle, carriage_pass_index)[source]

Bases: Swatch_Boundary_Instruction

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

Parameters:
left_boundary_type: Course_Boundary_Type
right_boundary_type: Course_Boundary_Type
carriage_pass_rack: int
carriage_pass_is_all_needle: bool
carriage_pass_index: int
property is_left: bool

Returns: bool: True if the boundary instruction can enter or exit the left side of its carriage pass.

property is_right: bool

Returns: bool: True if the boundary instruction can enter or exit the right side of its carriage pass.

property is_left_exit: bool

Returns: bool: True if the boundary instruction can exit the left side of its carriage pass.

property is_right_exit: bool

Returns: bool: True if the boundary instruction can exit the right side of its carriage pass.

property is_left_entrance: bool

Returns: bool: True if the boundary instruction can enter the left side of its carriage pass.

property is_right_entrance: bool

Returns: bool: True if the boundary instruction can enter the right side of its carriage pass.

has_potential_left_to_right_connection(right_boundary_instruction)[source]
Parameters:

right_boundary_instruction (Course_Boundary_Instruction) – The boundary instruction to find potential connection to, presuming it is on the right side of the boundary.

Returns:

True if the boundaries are on opposite course sides, proceed in the same carriage pass direction, and are an entrance exit pair. False, otherwise.

Return type:

bool

__str__()[source]
Returns:

A string expressing the entrance-exit direction and blocked status of this boundary instruction.

Return type:

str

__init__(instruction, source_swatch_name, left_boundary_type, right_boundary_type, carriage_pass_rack, carriage_pass_is_all_needle, carriage_pass_index)
Parameters:
__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