# utils.py
"""
This module provides utility functions used throughout the application,
such as helper functions for queue management, status updates,
and other common tasks.
"""

import queue

def put_queue(queue, item):
    """
    Puts an item in the queue. If the queue is full, the item is discarded.

    Args:
        queue (queue.Queue): The queue to put the item in.
        item (any): The item to put in the queue.
    """
    try:
        queue.put(item, block=False)
    except queue.Full:
        pass  # Drop value

def clear_queue(queue):
    """
    Clears all items from the queue.

    Args:
        queue (queue.Queue): The queue to clear.
    """
    with queue.mutex:
        queue.queue.clear()