ProcessListQueue

class jwst.associations.ProcessListQueue(init=None)[source]

Bases: object

First-In-First-Out queue of ProcessLists.

ProcessLists can be added either individually using jwst.associations.ProcessListQueue.append() method, or a list of ProcessLists can be added through object initialization or the jwst.associations.ProcessListQueue.extend() method.

There are two generators implement. The first is the ProcessListQueue object itself. When the object is used as a generator, the generator will return the earliest ProcessList added to the queue (FIFO), popping that ProcessList from the queue, hence draining the queue.

The second generator is returned by the jwst.associations.ProcessListQueue.items() method. This method will return all the items from all the ProcessLists in the queue, non-destructively. The ProcessLists are accessed in their order in the queue, and then each item is retrieved from their ProcessList in the list order of the ProcessList.

A final feature of ProcessListQueue is that it is mutable: New items can be added to the queue while items are being popped from the queue.

Notes

The FIFO operations depends on the fact that, inherently, dict preserves order in which key/value pairs are added to the dictionary.

Initialize a ProcessListQueue.

Parameters:
init[ProcessList[,…]] or None

List of ProcessLists to put on the queue.

Methods Summary

append(process_list)

Add ProcessList to queue, if not already in the queue.

extend(iterable)

Add lists of ProcessLists if not already in the queue.

items()

Return list generator of all items.

popleft()

Pop the first-in object.

Methods Documentation

append(process_list)[source]

Add ProcessList to queue, if not already in the queue.

extend(iterable)[source]

Add lists of ProcessLists if not already in the queue.

items()[source]

Return list generator of all items.

popleft()[source]

Pop the first-in object.

Returns:
[ProcessList, …]

The queue of ProcessList objects with the first one popped.