virtual_knitting_machine.knitting_machine_warnings.Yarn_Carrier_System_Warning module

A module containing warnings related to the yarn carrier system and yarn management operations. This module provides comprehensive warning classes for various yarn carrier issues including state mismatches, duplicate definitions, hook operation errors, and float length violations during machine knitting operations.

exception Yarn_Carrier_Warning(carrier_id, message, ignore_instruction=False)[source]

Bases: Knitting_Machine_Warning

Base class for warnings related to yarn carrier operations and states. This class provides a foundation for all yarn carrier-specific warnings and includes the carrier ID reference for detailed error reporting and system state tracking.

Parameters:
  • carrier_id (Any)

  • message (str)

  • ignore_instruction (bool)

__init__(carrier_id, message, ignore_instruction=False)[source]

Initialize a yarn carrier-specific warning.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier ID or carrier object involved in the warning condition.

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

  • ignore_instruction (bool, optional) – Whether this warning indicates that the operation should be ignored. Defaults to False.

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 Multiple_Yarn_Definitions_Warning(carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for multiple yarn property definitions on the same carrier. This warning occurs when yarn properties are defined multiple times for a single carrier, which may indicate conflicting yarn specifications or redundant operations.

Parameters:

carrier_id (Any)

__init__(carrier_id)[source]

Initialize a multiple yarn definitions warning.

Parameters:

carrier_id (int | Yarn_Carrier) – The carrier that has multiple yarn definitions.

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.

carrier_id: Yarn_Carrier | int
exception Release_Wrong_Carrier_Warning(carrier_id, hooked_carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for release hook operations targeting the wrong carrier. This warning occurs when attempting to release a carrier from the yarn inserting hook when that carrier is not currently hooked, providing information about which carrier is actually on the hook.

Parameters:
  • carrier_id (Any)

  • hooked_carrier_id (Any)

__init__(carrier_id, hooked_carrier_id)[source]

Initialize a wrong carrier release warning.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier that was incorrectly requested for release.

  • hooked_carrier_id (int | None | Yarn_Carrier) – The carrier that is actually on the yarn inserting hook, or None if no carrier is hooked.

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.

carrier_id: Yarn_Carrier | int
exception Loose_Release_Warning(carrier_id, loops_before_release, loose_loop_count)[source]

Bases: Yarn_Carrier_Warning

A warning for releasing loose yarn carriers with mismatched loop counts. This warning occurs when a loose yarn release operation is performed with a different number of stabilizing loops than requested, indicating potential yarn state inconsistencies.

Parameters:
  • carrier_id (Any)

  • loops_before_release (int)

  • loose_loop_count (int)

__init__(carrier_id, loops_before_release, loose_loop_count)[source]

Initialize a loose release warning.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier being released with loose yarn.

  • loops_before_release (int) – The actual number of stabilizing loops before the release operation.

  • loose_loop_count (int) – The number of loose loops that were requested for the release.

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.

carrier_id: Yarn_Carrier | int
exception Defined_Active_Yarn_Warning(carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for defining yarn properties on an already active carrier. This warning occurs when yarn properties are defined for a carrier that is already in active use, which may cause unexpected yarn behavior or state conflicts.

Parameters:

carrier_id (Any)

__init__(carrier_id)[source]

Initialize a defined active yarn warning.

Parameters:

carrier_id (int | Yarn_Carrier) – The active carrier for which yarn was being defined.

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.

carrier_id: Yarn_Carrier | int
exception In_Active_Carrier_Warning(carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for attempting to bring in a carrier that is already active. This warning occurs when an ‘in’ operation is performed on a carrier that is already in active state, indicating redundant operations or state tracking issues.

Parameters:

carrier_id (Any)

__init__(carrier_id)[source]

Initialize an ‘in’ active carrier warning.

Parameters:

carrier_id (int | Yarn_Carrier) – The carrier that is already active but was requested to be brought in.

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.

carrier_id: Yarn_Carrier | int
exception In_Loose_Carrier_Warning(carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for attempting to bring in a loose carrier without proper hook operations. This warning occurs when trying to bring in a carrier that has loose yarn, suggesting that an in-hook operation should be used instead for proper yarn management.

Parameters:

carrier_id (Any)

__init__(carrier_id)[source]

Initialize an ‘in’ loose carrier warning.

Parameters:

carrier_id (int | Yarn_Carrier) – The loose carrier that was attempted to be brought in.

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.

carrier_id: Yarn_Carrier | int
exception Out_Inactive_Carrier_Warning(carrier_id)[source]

Bases: Yarn_Carrier_Warning

A warning for attempting to bring out a carrier that is not currently active. This warning occurs when an ‘out’ operation is performed on a carrier that is already inactive, indicating redundant operations or state tracking issues.

Parameters:

carrier_id (Any)

__init__(carrier_id)[source]

Initialize an ‘out’ inactive carrier warning.

Parameters:

carrier_id (int | Yarn_Carrier) – The inactive carrier that was requested to be brought out.

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.

carrier_id: Yarn_Carrier | int
exception Duplicate_Carriers_In_Set(carrier_id, carrier_set)[source]

Bases: Yarn_Carrier_Warning

A warning for duplicate carrier IDs found in carrier sets. This warning occurs when a carrier set is created with duplicate carrier IDs, and the system automatically removes the duplicates to maintain set integrity.

Parameters:
__init__(carrier_id, carrier_set)[source]

Initialize a duplicate carriers in set warning.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The duplicate carrier ID that was removed.

  • carrier_set (list[int]) – The original carrier set containing duplicates.

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.

carrier_id: Yarn_Carrier | int
exception Long_Float_Warning(carrier_id, prior_needle, next_needle, max_float_len)[source]

Bases: Yarn_Carrier_Warning

A warning for float segments that exceed the maximum allowed length. This warning occurs when yarn floats between needles exceed the specified maximum float length, which may cause knitting issues or affect fabric quality.

Parameters:
__init__(carrier_id, prior_needle, next_needle, max_float_len)[source]

Initialize a long float warning.

Parameters:
  • carrier_id (int | Yarn_Carrier) – The carrier creating the long float.

  • prior_needle (Needle) – The needle where the float begins.

  • next_needle (Needle) – The needle where the float ends.

  • max_float_len (int) – The maximum allowed float length that was exceeded.

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.

carrier_id: Yarn_Carrier | int