knit_script.knit_script_exceptions.gauge_sheet_exceptions module
This module contains Knit Script Exceptions related to the gauge and sheet management system.
These exceptions are raised when the code reaches an error state caused by mismanagement of gauge and sheet configurations in multi-sheet knitting operations. The exceptions provide detailed information about gauge limits, sheet boundaries, and complex sheet peeling operations that are essential for advanced knitting techniques.
- exception Gauge_Value_Exception(gauge)[source]
Bases:
Knit_Script_Exception
Exception raised when gauge is set beyond the machine’s capabilities.
- This exception occurs when attempting to set a gauge value that is outside the acceptable range for the knitting machine,
typically when the gauge is too low (less than 1) or too high (exceeding machine limits). The gauge value determines the number of sheets in multi-sheet knitting configurations and must be within the machine’s supported range.
- Parameters:
gauge (
int
)
- __init__(gauge)[source]
Initialize the Gauge_Value_Exception.
- Parameters:
gauge (int) – The invalid gauge value that was provided and caused the exception.
- 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 Sheet_Value_Exception(sheet, current_gauge)[source]
Bases:
Knit_Script_Exception
Exception raised when sheet is set to an unacceptable value.
This exception occurs when attempting to set an active sheet number that is outside the valid range for the current gauge configuration. Sheet numbers must be between 0 and gauge-1, as each sheet represents one layer in the multi-sheet gauge configuration.
- 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 Sheet_Peeling_Stacked_Loops_Exception(front_needle, back_needle)[source]
Bases:
Knit_Script_Exception
Exception raised when trying to peel loops that cannot be returned to a separated state.
- This exception occurs during sheet peeling operations when loops that were recorded on both front and back needles cannot be properly separated
and returned to their original positions due to the current machine state. This typically happens when the peeling process encounters stacked loops that cannot be cleanly separated.
- Parameters:
front_needle (
Needle
)back_needle (
Needle
)
- __init__(front_needle, back_needle)[source]
Initialize the Sheet_Peeling_Stacked_Loops_Exception.
- Parameters:
front_needle (Needle) – The front needle with recorded loops that cannot be properly separated.
back_needle (Needle) – The back needle with recorded loops that cannot be properly separated.
- 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 Sheet_Peeling_Blocked_Loops_Exception(return_to_needle, return_from_needle)[source]
Bases:
Knit_Script_Exception
Exception raised when loops cannot be returned due to blocking loops on the target needle.
This exception occurs during sheet reset operations when loops need to be transferred back to their recorded positions but are blocked by existing loops on the target needle. This prevents the proper restoration of the sheet configuration.
- Parameters:
return_to_needle (
Needle
)return_from_needle (
Needle
)
- __init__(return_to_needle, return_from_needle)[source]
Initialize the Sheet_Peeling_Blocked_Loops_Exception.
- Parameters:
return_to_needle (Needle) – The needle that has blocking loops preventing the return operation.
return_from_needle (Needle) – The needle attempting to return loops to the blocked target.
- 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 Lost_Sheet_Loops_Exception(recorded_needle)[source]
Bases:
Knit_Script_Exception
Exception raised when loops are lost and the sheet cannot be reset.
This exception occurs when loops that were recorded on a needle during sheet operations are no longer present when attempting to reset the sheet, indicating that the loops have been lost or moved unexpectedly. This prevents the sheet from being properly restored to its recorded state.
- Parameters:
recorded_needle (
Needle
)
- __init__(recorded_needle)[source]
Initialize the Lost_Sheet_Loops_Exception.
- Parameters:
recorded_needle (Needle) – The needle where loops were recorded but are now lost.
- 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.