mafw.enumerators

Module provides a set of enumerators for dealing with standard tasks.

Classes

LogicalOp(*values)

Enumeration of supported logical operations.

LoopType(*values)

The loop strategy for the processor.

LoopingStatus(*values)

Enumerator to modify the looping cycle.

ProcessorExitStatus(*values)

The processor exit status enumerator class

ProcessorStatus(*values)

Enumerator to describe the status of a processor.

class mafw.enumerators.LogicalOp(*values)[source]

Bases: Enum

Enumeration of supported logical operations.

Added in version v1.3.0.

class mafw.enumerators.LoopType(*values)[source]

Bases: StrEnum

The loop strategy for the processor.

Each processor can be executed in one of the following modes:

  1. Single mode. The process method is executed only once.

  2. For loop mode. The process method is executed inside a for loop after the start and before the finish. The loop is based on a list of elements, the user must overload the get_items() method to define the list of items for the loop.

  3. Parallel for loop mode. Conceptually identical to the for loop mode, but instead of a serial processing, items are shared among a pool of different threads. This looping mode is only available when running with a free-threading version of Python (recommended >= 3.14.4). In case free-threading is not available, the item processing will automatically fall back to the serial for loop mode.

  4. Parallel for loop with queue mode. Similar to the parallel for loop, but processed items are pushed to a queue and handled by a single consumer thread. This allows serialized handling of accept_item() and skip_item() while still distributing the main processing over multiple workers. As with the parallel for loop, this execution mode is only available with free-threading and falls back to the serial for loop otherwise.

  5. While loop mode. The process method is executed inside a while loop after the start and before the finish. The user must overload the while_condition() to define when to stop the loop.

static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

ForLoop = 'for_loop'

Value for the for loop on item list execution.

ParallelForLoop = 'parallel_for_loop'

Value for the parallel for loop on item list execution.

ParallelForLoopWithQueue = 'parallel_for_loop_with_queue'

Value for the parallel for loop with queue execution.

SingleLoop = 'single'

Value for the single mode execution.

WhileLoop = 'while_loop'

Value for the while loop execution.

class mafw.enumerators.LoopingStatus(*values)[source]

Bases: IntEnum

Enumerator to modify the looping cycle.

In the case of a looping Processor, the user has the ability to slightly modify the looping structure using this enumerator.

In the process() the user can set the variable looping_status to one of the following values:

The last two options are apparently identical, but they offer the possibility to implement a different behaviour in the finish() method. When abort is used, then the AbortProcessorException will be raised. For example, the user can decide to rollback all changes if an abort as occurred or to save what done so far in case of a quit.

Abort = 3

Break the loop and force the outside container (mafw.processor.ProcessorList) to quit.

Continue = 1

The loop can continue

Quit = 4

Break the loop but let the outside container (mafw.processor.ProcessorList) to continue.

Skip = 2

Skip this item.

class mafw.enumerators.ProcessorExitStatus(*values)[source]

Bases: IntEnum

The processor exit status enumerator class

  • Successful: means that the processor reached the end with success

  • Failed: means that the processor did not reach the end with success

  • Aborted: means that the user aborted the processor execution

Aborted = 3

The processor execution was aborted by the user

Failed = 2

The processor execution was failed

Successful = 1

The processor execution was successfully concluded

class mafw.enumerators.ProcessorStatus(*values)[source]

Bases: StrEnum

Enumerator to describe the status of a processor.

static _generate_next_value_(name, start, count, last_values)

Return the lower-cased version of the member name.

Finish = 'finishing'

Finished

Init = 'initializing'

Initialized

Run = 'processing'

Running

Start = 'starting'

Started

Unknown = 'unknown'

Unknown status