INNER CODE UNIT · Python
__init__
bkbilly/lnxlink · lnxlink/__main__.py:31
def __init__(self, max_size=200):
"""Initializes the UniqueQueue"""
self.queue = OrderedDict()
self.max_size = max_size
self._lock = threading.Lock()
self._condition = threading.Condition(self._lock)
self._sequence = 0
def __repr__(self):
"""Returns a string representation of the queue."""
return f"<{self.__class__.__name__} queue: {repr(self.queue)}>"
def __iter__(self):
"""Returns an iterator that yields and removes items from the queue in FIFO order"""
with self._condition:
remaining = len(self.queue)
for _ in range(remaining):
with self._condition: