knit_graphs.Pull_Direction module

Enumerator used to define the two pull-directions of a loop through other loops.

This module defines the Pull_Direction enumeration which represents the two ways a loop can be pulled through other loops in knitting: from back to front (knit) or from front to back (purl).

class Pull_Direction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

An enumerator of the two pull-directions of a loop in knitting operations.

This enumeration represents the two directions that yarn can be pulled through loops to create different stitch types. BtF (Back to Front) creates knit stitches, while FtB (Front to Back) creates purl stitches.

BtF = 'Knit'
FtB = 'Purl'
opposite()[source]

Get the opposite pull direction of this direction.

Returns:

The opposite pull direction. If this is BtF, returns FtB. If this is FtB, returns BtF.

Return type:

Pull_Direction

__neg__()[source]

Get the opposite pull direction using the negation operator.

Returns:

The opposite pull direction, same as calling opposite().

Return type:

Pull_Direction

__invert__()[source]

Get the opposite pull direction using the bitwise inversion operator.

Returns:

The opposite pull direction, same as calling opposite().

Return type:

Pull_Direction

__str__()[source]

Get the string representation of the pull direction.

Returns:

The value of the pull direction (“Knit” for BtF, “Purl” for FtB).

Return type:

str

__repr__()[source]

Get the representation string of the pull direction for debugging.

Returns:

The name of the pull direction (“BtF” or “FtB”).

Return type:

str

__hash__()[source]

Get the hash value of the pull direction for use in sets and dictionaries.

Returns:

Hash value based on the pull direction name.

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)