K i bdZddlmZddlZddlmZerddlmZGddejZy)uUtility collections or "bricks". :module: watchdog.utils.bricks :author: yesudeep@google.com (Yesudeep Mangalapilly) :author: lalinsky@gmail.com (Lukáš Lalinský) :author: python@rcn.com (Raymond Hettinger) :author: contact@tiger-222.fr (Mickaël Schoentgen) Classes ======= .. autoclass:: OrderedSetQueue :members: :show-inheritance: :inherited-members: .. autoclass:: OrderedSet ) annotationsN) TYPE_CHECKING)AnycJeZdZdZdfd Zddfd Zd fd Zd fd ZxZS) SkipRepeatsQueueaThread-safe implementation of an special queue where a put of the last-item put'd will be dropped. The implementation leverages locking already implemented in the base class redefining only the primitives. Queued items must be immutable and hashable so that they can be used as dictionary keys. You must implement **only read-only properties** and the :meth:`Item.__hash__()`, :meth:`Item.__eq__()`, and :meth:`Item.__ne__()` methods for items to be hashable. An example implementation follows:: class Item: def __init__(self, a, b): self._a = a self._b = b @property def a(self): return self._a @property def b(self): return self._b def _key(self): return (self._a, self._b) def __eq__(self, item): return self._key() == item._key() def __ne__(self, item): return self._key() != item._key() def __hash__(self): return hash(self._key()) based on the OrderedSetQueue below c2t||d|_yN)super_init _last_item)selfmaxsize __class__s [/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/watchdog/utils/bricks.pyr zSkipRepeatsQueue._initGs  gc`|j||jk7rt| |||yy)zThis method will be used by `eventlet`, when enabled, so we cannot use force proper keyword-only arguments nor touch the signature. Also, the `timeout` argument will be ignored in that case. N)r r put)r itemblocktimeoutrs rrzSkipRepeatsQueue.putKs/ ?? "ddoo&= GKeW -'>rc2t||||_yr )r _putr r rrs rrzSkipRepeatsQueue._putRs  TrcNt|}||jurd|_|Sr )r _getr rs rrzSkipRepeatsQueue._getVs&w|~ 4?? ""DO r)rintreturnNone)TN)rrrboolrz float | Nonerr)rrrr)rr) __name__ __module__ __qualname____doc__r rrr __classcell__)rs@rrrs"'R.rr) r# __future__rqueuetypingrrQueuerrrr*s+&# =u{{=r