[docs]classQueue(ABC,Generic[_T]):"""Abstract class for representing a queue."""__slots__=()
[docs]@abstractmethoddef__bool__(self)->bool:"""Returns whether the queue contains at least one element"""
[docs]@abstractmethod@overridedef__repr__(self)->str:"""String representation of the queue. The elements appear in the order they will be popped. """
[docs]@abstractmethoddefhead(self)->_T:""" Returns: The element at the head of the queue. Raises: Empty: The queue is empty. """
[docs]@abstractmethoddefpop(self)->_T:"""Remove the element at the head of the queue, and return it. Returns: The element at the head of the queue. Raises: Empty: The queue is empty. """
[docs]@abstractmethoddefadd(self,element:_T)->None:"""Add the given element to the queue. Args: element: The element in question. """
[docs]@abstractmethoddefremove(self,element:_T)->None:"""Delete the given element from the queue. Args: element: The element in question. Raises: ValueError: The element is not present in the queue. """