mafw.enumerators
Module provides a set of enumerators for dealing with standard tasks.
Classes
|
Enumeration of supported logical operations. |
|
The loop strategy for the processor. |
|
Enumerator to modify the looping cycle. |
|
The processor exit status enumerator class |
|
Enumerator to describe the status of a processor. |
- class mafw.enumerators.LogicalOp(value)[source]
Bases:
EnumEnumeration of supported logical operations.
Added in version 1.3.0.
- class mafw.enumerators.LoopType(value)[source]
Bases:
StrEnumThe loop strategy for the processor.
Each processor can be executed in one of the following modes:
Single mode. The process method is executed only once.
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.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.
Future development
Implement concurrent loop. Depending on the development of the free-threading capabilities of future python releases, this concurrent looping strategy might be based on threads or a porting of the
autoradmulti-processor approach.- _generate_next_value_(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.
- SingleLoop = 'single'
Value for the single mode execution.
- WhileLoop = 'while_loop'
Value for the while loop execution.
- class mafw.enumerators.LoopingStatus(value)[source]
Bases:
IntEnumEnumerator 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:LoopingStatus.Continue. It means that everything is working well and the loop cycle must go ahead as foreseen and theaccept_item()will be invoked.LoopingStatus.Skip. Theskip_item()will be called soon after theprocess()is finished. The status will be reset to Continue and the next item will be processed.LoopingStatus.Abort. The cycle is broken immediately.LoopingStatus.Quit. The cycle is broken immediately.
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 theAbortProcessorExceptionwill 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(value)[source]
Bases:
IntEnumThe 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(value)[source]
Bases:
StrEnumEnumerator to describe the status of a processor.
- _generate_next_value_(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