fastqueue API Reference

class fastqueue.Queue(iterable: Iterable | None = None)

A Queue class that implements a FIFO data structure. This queue is made up of a linked list of nodes, each containing a queue.

copy()

Return a shallow copy of the Queue.

Returns:

A shallow copy of the Queue object.

dequeue()

Remove and return an item from the end of the Queue.

Returns:

The item removed from the Queue.

enqueue(item: Any) None

Add an item to the front of the Queue.

Parameters:
  • item – (Any): The item to be added to the Queue.

  • self

extend(items: Iterable[Any]) None

Enqueue a sequence of elements from an iterator.

Parameters:

items – (Iterable[Any]): An iterable containing the

elements to be enqueued. :param self:

is_empty() bool

Returns whether the Queue is empty.

Returns:

True if the Queue is empty, False otherwise.

class fastqueue.QueueC(iterable: Iterable | None = None)

A Queue class that implements a FIFO data structure. This queue is made up a single contiguous container.

copy()

Return a shallow copy of the Queue.

Returns:

A shallow copy of the Queue object.

dequeue()

Remove and return an item from the end of the Queue.

Returns:

The item removed from the Queue.

enqueue(item: Any) None

Add an item to the front of the Queue.

Parameters:
  • item – (Any): The item to be added to the Queue.

  • self

extend(items: Iterable[Any]) None

Enqueue a sequence of elements from an iterator.

Parameters:

items – (Iterable[Any]): An iterable containing the

elements to be enqueued. :param self:

is_empty() bool

Returns whether the Queue is empty.

Returns:

True if the Queue is empty, False otherwise.

class fastqueue.LockQueue(iterable: Iterable | None = None)

A Queue class that implements a FIFO data structure with locking.

copy()

Return a shallow copy of the Queue.

Returns:

A shallow copy of the Queue object.

dequeue()

Remove and return an item from the end of the Queue.

Returns:

The item removed from the Queue.

enqueue(item: Any) None

Add an item to the front of the Queue.

Parameters:
  • item – (Any): The item to be added to the Queue.

  • self

extend(items: Iterable[Any]) None

Enqueue a sequence of elements from an iterator.

Parameters:

items – (Iterable[Any]): An iterable containing the

elements to be enqueued. :param self:

get()

Return the first element of the LockQueue, None if no element exists.

Returns:

The first element of the LockQueue, or None if the LockQueue

is empty.

is_empty() bool

Returns whether the Queue is empty.

Returns:

True if the Queue is empty, False otherwise.