notification_queue
Queue management for Streamlit notifications.
- streamlit_notify.notification_queue.default_sort_func(x)[source]
Sort notifications by priority (highest first).
- Parameters:
- Return type:
- class streamlit_notify.notification_queue.NotificationPriorityQueue(queue_name, sort_func=None)[source]
Bases:
objectA Priority queue for managing Streamlit notifications.
Initialize the queue.
- Parameters:
queue_name (str)
sort_func (Callable[[StatusElementNotification], int] | None)
- __init__(queue_name, sort_func=None)[source]
Initialize the queue.
- Parameters:
queue_name (str)
sort_func (Callable[[StatusElementNotification], int] | None)
- Return type:
None
- property queue: List[StatusElementNotification]
Get the current queue.
- property sort_func: Callable[[StatusElementNotification], int]
Get the sorting function for the queue.
- append(item)[source]
Add an item to the queue.
- Parameters:
item (StatusElementNotification)
- Return type:
None
- extend(items)[source]
Add multiple items to the queue.
- Parameters:
items (Iterable[StatusElementNotification])
- Return type:
None
- remove(item)[source]
Remove an item from the queue.
- Parameters:
item (StatusElementNotification | int)
- Return type:
None
- contains(item)[source]
Check if an item is in the queue.
- Parameters:
item (StatusElementNotification)
- Return type:
- _get_all_less_than(priority)[source]
Get all items in the queue with priority less than the specified value.
- Parameters:
priority (int)
- Return type:
- _get_all_less_than_equal_to(priority)[source]
Get all items in the queue with priority less than or equal to the specified value.
- Parameters:
priority (int)
- Return type:
- _get_all_greater_than(priority)[source]
Get all items in the queue with priority greater than the specified value.
- Parameters:
priority (int)
- Return type:
- _get_all_greater_than_equal_to(priority)[source]
Get all items in the queue with priority greater than or equal to the specified value.
- Parameters:
priority (int)
- Return type:
- _get_all_equal_to(priority)[source]
Get all items in the queue with priority equal to the specified value.
- Parameters:
priority (int)
- Return type:
- get_all(priority=None, priority_type='eq')[source]
Get all items in the queue.
- Parameters:
- Return type:
- get(index=0)[source]
Get an item from the queue without removing it.
- Parameters:
index (int)
- Return type:
- __contains__(item)[source]
Check if an item is in the queue.
- Parameters:
item (StatusElementNotification)
- Return type:
- __setitem__(index, value)[source]
Set an item by index.
- Parameters:
index (int)
value (StatusElementNotification)
- Return type:
None
- __iter__()[source]
Iterate over the notifications in the queue.
- Return type:
Generator[StatusElementNotification, None, None]
- __reversed__()[source]
Iterate over the notifications in reverse order.
- Return type:
Generator[StatusElementNotification, None, None]