InterimIterator

class lib.infer.iterator.InterimIterator(queue: Queue[QueueItemInT | ExtractSignal], name: str, plugin_type: T.Literal['detect', 'align', 'mask', 'identity', 'file'], batch_size: int, error_state: ErrorState)

Bases: ExtractIterator[ExtractBatch, ExtractBatch]

An iterator that simply collects interim ExtractBatch objects from the given queue and yields them

Parameters:
  • queue (Queue[QueueItemInT | ExtractSignal]) – The inbound queue to the plugin

  • name (str) – The plugin name and process calling this iterator

  • plugin_type (T.Literal['detect', 'align', 'mask', 'identity', 'file']) – The type of extractor plugin that this iterator is serving

  • batch_size (int) – The batch size that data should be returned from the iterator

  • error_state (ErrorState)

__next__() ExtractBatch | ExtractSignal

Get the next batch of data from the iterator

Returns:

The next available ExtractBatch object to process through the plugin or an ExtractSignal

Return type:

ExtractBatch or ExtractSignal

Raises:

StopIteration – When the input is exhausted