avl._core.fifo module

class avl._core.fifo.Fifo(depth: int, *args: list[Any])[source]
__init__(depth: int, *args: list[Any]) None[source]

Initializes a FIFO (First In, First Out) list with a specified depth. The FIFO will only allow appending elements until it reaches its depth limit.

Parameters:
  • depth (int) – The maximum number of elements the FIFO can hold.

  • args (list[Any]) – Additional arguments to be passed to the List constructor.

append(data: Any) None[source]

Appends an element to the FIFO if it is not full.

Parameters:

data (Any) – The element to be appended.

extend(iterable: Iterable) None[source]

Extends the FIFO with elements from an iterable, ensuring it does not exceed its depth.

Parameters:

iterable (list[Any]) – The iterable to extend the FIFO with.

insert(index: SupportsIndex, data: Any) None[source]

Raises NotImplementedError as insertion at arbitrary positions is not supported.

Parameters:
  • index (int) – The index at which to insert.

  • data (Any) – The data to be inserted.

Raises:

NotImplementedError – This method is not implemented for FIFO.

remove(data: Any) None[source]

Raises NotImplementedError as removing elements is not supported in FIFO. This is because FIFO operates on a first-in, first-out basis and does not allow arbitrary removals.

Parameters:

data (Any) – The element to be removed.

Raises:

NotImplementedError – This method is not implemented for FIFO.

async blocking_push(data: Any) None[source]

Pushes an element onto the FIFO, blocking if the FIFO is full.

Parameters:

data (Any) – The element to be pushed onto the FIFO.

async blocking_put(data: Any) None[source]

Alias for blocking_push. Pushes an element onto the FIFO, blocking if the FIFO is full.

Parameters:

data (Any) – The element to be put into the FIFO.