pystreaming.listlib package

Submodules

pystreaming.listlib.circulardict module

class pystreaming.listlib.circulardict.CircularOrderedDict(maxsize)[source]

Bases: object

A dictionary that never exceeds a given size. If the size limit is reached, the least recently inserted element is removed.

Parameters

maxsize (int) – Maximum size of the dictionary.

Raises

ValueError – Raised if maxsize argument is not a positve integer.

delete(key)[source]

Delete an entry from the dictionary

Parameters

key (pyobj) – Key to delete.

insert_end(key, value)[source]

Insert key-value pair into end of dictionary. If the key already exists, the key-value pair will be moved to the end of the dictionary and the value will be updated.

Parameters
  • key (pyobj) – Key in key-value pair.

  • value (pyobj) – Value in key-value pair.

keys()[source]

Retrieve all keys in the dictionary, from earliest to latest.

Returns

Iterable object of keys.

Return type

odict_keys

pop_front()[source]

Pop key, value pair from front of dictionary.

Returns

(key, value)

Return type

tuple

pystreaming.listlib.circularlist module

class pystreaming.listlib.circularlist.CircularList(maxsize=10)[source]

Bases: object

Initialize a Circular List with maximum size.

Parameters

maxsize (int, optional) – Maximum number of elements the list can store before it begins to overwrite old elements. Defaults to 10.

Raises

ValueError – Raised if maxsize argument is not a positve integer.

full()[source]

Check whether the current list size is the maximum size.

Returns

True if full else False.

Return type

boolean

pop()[source]

Pop an element off FIFO (queue) style.

Raises

Empty – Raised when there are no elements in the queue.

Returns

The first element in the list.

Return type

pyobj

push(item)[source]

Push an element FIFO (queue) style.

Parameters

item (pyobj) – Object to push.

exception pystreaming.listlib.circularlist.Empty(calltype)[source]

Bases: Exception

Raised when trying to pop from an empty queue

Module contents