virtual_knitting_machine.knitting_machine_warnings.Needle_Warnings module

A module containing warnings related to needle operations and states on knitting machines. This module provides warning classes for various needle-related issues including loop capacity violations, transfer operations on empty needles, and knitting operations on needles without loops.

exception Needle_Warning(needle, message)[source]

Bases: Knitting_Machine_Warning

Base class for warnings related to specific needle operations and states. This class provides a foundation for all needle-specific warnings and includes the needle reference for detailed error reporting and debugging.

Parameters:
__init__(needle, message)[source]

Initialize a needle-specific warning.

Parameters:
  • needle (Needle) – The needle involved in the warning condition.

  • message (str) – The descriptive warning message about the needle state or operation.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception Needle_Holds_Too_Many_Loops(needle, max_loop_allowance)[source]

Bases: Needle_Warning

A warning for needles that have reached their maximum loop holding capacity. This warning occurs when attempting to add loops to a needle that is already at or near its maximum capacity as defined by the machine specification.

Parameters:
__init__(needle, max_loop_allowance)[source]

Initialize a needle capacity exceeded warning.

Parameters:
  • needle (Needle) – The needle that has exceeded its loop holding capacity.

  • max_loop_allowance (int) – The maximum number of loops the needle is allowed to hold.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

needle: Needle
exception Transfer_From_Empty_Needle(needle)[source]

Bases: Needle_Warning

A warning for transfer operations attempted on needles that do not hold any loops. This warning indicates that a transfer operation was requested from an empty needle, which may not produce the expected knitting results.

Parameters:

needle (Needle)

__init__(needle)[source]

Initialize a transfer from empty needle warning.

Parameters:

needle (Needle) – The empty needle from which a transfer was attempted.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

needle: Needle
exception Knit_on_Empty_Needle_Warning(needle)[source]

Bases: Needle_Warning

A warning for knitting operations attempted on needles that do not hold any loops. This warning indicates that a knitting operation was requested on an empty needle, which may produce unexpected results or indicate a programming error in the knitting sequence.

Parameters:

needle (Needle)

__init__(needle)[source]

Initialize a knit on empty needle warning.

Parameters:

needle (Needle) – The empty needle on which a knit operation was attempted.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

needle: Needle