�ɲɾ�����ӯ�����һ��ˣ��������С���˴��ͣ�������P���ҹ��ñ˽��ά�Բ��������˸߸ԣ�������ơ��ҹ��ñ�����ά�Բ���ˡ���˳^�ӣ������ӡ� ���ͯj�ӣ��ƺ���ӣ� ? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!? PNG ?%k25u25%fgd5n!PK03]ii _utilities.pynu[from weakref import ref from blinker._saferef import BoundMethodWeakref try: callable except NameError: def callable(object): return hasattr(object, '__call__') try: from collections import defaultdict except: class defaultdict(dict): def __init__(self, default_factory=None, *a, **kw): if (default_factory is not None and not hasattr(default_factory, '__call__')): raise TypeError('first argument must be callable') dict.__init__(self, *a, **kw) self.default_factory = default_factory def __getitem__(self, key): try: return dict.__getitem__(self, key) except KeyError: return self.__missing__(key) def __missing__(self, key): if self.default_factory is None: raise KeyError(key) self[key] = value = self.default_factory() return value def __reduce__(self): if self.default_factory is None: args = tuple() else: args = self.default_factory, return type(self), args, None, None, self.items() def copy(self): return self.__copy__() def __copy__(self): return type(self)(self.default_factory, self) def __deepcopy__(self, memo): import copy return type(self)(self.default_factory, copy.deepcopy(self.items())) def __repr__(self): return 'defaultdict(%s, %s)' % (self.default_factory, dict.__repr__(self)) try: from contextlib import contextmanager except ImportError: def contextmanager(fn): def oops(*args, **kw): raise RuntimeError("Python 2.5 or above is required to use " "context managers.") oops.__name__ = fn.__name__ return oops class _symbol(object): def __init__(self, name): """Construct a new named symbol.""" self.__name__ = self.name = name def __reduce__(self): return symbol, (self.name,) def __repr__(self): return self.name _symbol.__name__ = 'symbol' class symbol(object): """A constant symbol. >>> symbol('foo') is symbol('foo') True >>> symbol('foo') foo A slight refinement of the MAGICCOOKIE=object() pattern. The primary advantage of symbol() is its repr(). They are also singletons. Repeated calls of symbol('name') will all return the same instance. """ symbols = {} def __new__(cls, name): try: return cls.symbols[name] except KeyError: return cls.symbols.setdefault(name, _symbol(name)) try: text = (str, unicode) except NameError: text = str def hashable_identity(obj): if hasattr(obj, '__func__'): return (id(obj.__func__), id(obj.__self__)) elif hasattr(obj, 'im_func'): return (id(obj.im_func), id(obj.im_self)) elif isinstance(obj, text): return obj else: return id(obj) WeakTypes = (ref, BoundMethodWeakref) class annotatable_weakref(ref): """A weakref.ref that supports custom instance attributes.""" def reference(object, callback=None, **annotations): """Return an annotated weak ref.""" if callable(object): weak = callable_reference(object, callback) else: weak = annotatable_weakref(object, callback) for key, value in annotations.items(): setattr(weak, key, value) return weak def callable_reference(object, callback=None): """Return an annotated weak ref, supporting bound instance methods.""" if hasattr(object, 'im_self') and object.im_self is not None: return BoundMethodWeakref(target=object, on_delete=callback) elif hasattr(object, '__self__') and object.__self__ is not None: return BoundMethodWeakref(target=object, on_delete=callback) return annotatable_weakref(object, callback) class lazy_property(object): """A @property that is only evaluated once.""" def __init__(self, deferred): self._deferred = deferred self.__doc__ = deferred.__doc__ def __get__(self, obj, cls): if obj is None: return self value = self._deferred(obj) setattr(obj, self._deferred.__name__, value) return value PK03]Lu??base.pynu[# -*- coding: utf-8; fill-column: 76 -*- """Signals and events. A small implementation of signals, inspired by a snippet of Django signal API client code seen in a blog post. Signals are first-class objects and each manages its own receivers and message emission. The :func:`signal` function provides singleton behavior for named signals. """ from warnings import warn from weakref import WeakValueDictionary from blinker._utilities import ( WeakTypes, contextmanager, defaultdict, hashable_identity, lazy_property, reference, symbol, ) ANY = symbol('ANY') ANY.__doc__ = 'Token for "any sender".' ANY_ID = 0 class Signal(object): """A notification emitter.""" #: An :obj:`ANY` convenience synonym, allows ``Signal.ANY`` #: without an additional import. ANY = ANY @lazy_property def receiver_connected(self): """Emitted after each :meth:`connect`. The signal sender is the signal instance, and the :meth:`connect` arguments are passed through: *receiver*, *sender*, and *weak*. .. versionadded:: 1.2 """ return Signal(doc="Emitted after a receiver connects.") @lazy_property def receiver_disconnected(self): """Emitted after :meth:`disconnect`. The sender is the signal instance, and the :meth:`disconnect` arguments are passed through: *receiver* and *sender*. Note, this signal is emitted **only** when :meth:`disconnect` is called explicitly. The disconnect signal can not be emitted by an automatic disconnect (due to a weakly referenced receiver or sender going out of scope), as the receiver and/or sender instances are no longer available for use at the time this signal would be emitted. An alternative approach is available by subscribing to :attr:`receiver_connected` and setting up a custom weakref cleanup callback on weak receivers and senders. .. versionadded:: 1.2 """ return Signal(doc="Emitted after a receiver disconnects.") def __init__(self, doc=None): """ :param doc: optional. If provided, will be assigned to the signal's __doc__ attribute. """ if doc: self.__doc__ = doc #: A mapping of connected receivers. #: #: The values of this mapping are not meaningful outside of the #: internal :class:`Signal` implementation, however the boolean value #: of the mapping is useful as an extremely efficient check to see if #: any receivers are connected to the signal. self.receivers = {} self._by_receiver = defaultdict(set) self._by_sender = defaultdict(set) self._weak_senders = {} def connect(self, receiver, sender=ANY, weak=True): """Connect *receiver* to signal events sent by *sender*. :param receiver: A callable. Will be invoked by :meth:`send` with `sender=` as a single positional argument and any \*\*kwargs that were provided to a call to :meth:`send`. :param sender: Any object or :obj:`ANY`, defaults to ``ANY``. Restricts notifications delivered to *receiver* to only those :meth:`send` emissions sent by *sender*. If ``ANY``, the receiver will always be notified. A *receiver* may be connected to multiple *sender* values on the same Signal through multiple calls to :meth:`connect`. :param weak: If true, the Signal will hold a weakref to *receiver* and automatically disconnect when *receiver* goes out of scope or is garbage collected. Defaults to True. """ receiver_id = hashable_identity(receiver) if weak: receiver_ref = reference(receiver, self._cleanup_receiver) receiver_ref.receiver_id = receiver_id else: receiver_ref = receiver if sender is ANY: sender_id = ANY_ID else: sender_id = hashable_identity(sender) self.receivers.setdefault(receiver_id, receiver_ref) self._by_sender[sender_id].add(receiver_id) self._by_receiver[receiver_id].add(sender_id) del receiver_ref if sender is not ANY and sender_id not in self._weak_senders: # wire together a cleanup for weakref-able senders try: sender_ref = reference(sender, self._cleanup_sender) sender_ref.sender_id = sender_id except TypeError: pass else: self._weak_senders.setdefault(sender_id, sender_ref) del sender_ref # broadcast this connection. if receivers raise, disconnect. if ('receiver_connected' in self.__dict__ and self.receiver_connected.receivers): try: self.receiver_connected.send(self, receiver=receiver, sender=sender, weak=weak) except: self.disconnect(receiver, sender) raise if receiver_connected.receivers and self is not receiver_connected: try: receiver_connected.send(self, receiver_arg=receiver, sender_arg=sender, weak_arg=weak) except: self.disconnect(receiver, sender) raise return receiver def connect_via(self, sender, weak=False): """Connect the decorated function as a receiver for *sender*. :param sender: Any object or :obj:`ANY`. The decorated function will only receive :meth:`send` emissions sent by *sender*. If ``ANY``, the receiver will always be notified. A function may be decorated multiple times with differing *sender* values. :param weak: If true, the Signal will hold a weakref to the decorated function and automatically disconnect when *receiver* goes out of scope or is garbage collected. Unlike :meth:`connect`, this defaults to False. The decorated function will be invoked by :meth:`send` with `sender=` as a single positional argument and any \*\*kwargs that were provided to the call to :meth:`send`. .. versionadded:: 1.1 """ def decorator(fn): self.connect(fn, sender, weak) return fn return decorator @contextmanager def connected_to(self, receiver, sender=ANY): """Execute a block with the signal temporarily connected to *receiver*. :param receiver: a receiver callable :param sender: optional, a sender to filter on This is a context manager for use in the ``with`` statement. It can be useful in unit tests. *receiver* is connected to the signal for the duration of the ``with`` block, and will be disconnected automatically when exiting the block: .. testsetup:: from __future__ import with_statement from blinker import Signal on_ready = Signal() receiver = lambda sender: None .. testcode:: with on_ready.connected_to(receiver): # do stuff on_ready.send(123) .. versionadded:: 1.1 """ self.connect(receiver, sender=sender, weak=False) try: yield None except: self.disconnect(receiver) raise else: self.disconnect(receiver) def temporarily_connected_to(self, receiver, sender=ANY): """An alias for :meth:`connected_to`. :param receiver: a receiver callable :param sender: optional, a sender to filter on .. versionadded:: 0.9 .. versionchanged:: 1.1 Renamed to :meth:`connected_to`. ``temporarily_connected_to`` was deprecated in 1.2 and will be removed in a subsequent version. """ warn("temporarily_connected_to is deprecated; " "use connected_to instead.", DeprecationWarning) return self.connected_to(receiver, sender) def send(self, *sender, **kwargs): """Emit this signal on behalf of *sender*, passing on \*\*kwargs. Returns a list of 2-tuples, pairing receivers with their return value. The ordering of receiver notification is undefined. :param \*sender: Any object or ``None``. If omitted, synonymous with ``None``. Only accepts one positional argument. :param \*\*kwargs: Data to be sent to receivers. """ # Using '*sender' rather than 'sender=None' allows 'sender' to be # used as a keyword argument- i.e. it's an invisible name in the # function signature. if len(sender) == 0: sender = None elif len(sender) > 1: raise TypeError('send() accepts only one positional argument, ' '%s given' % len(sender)) else: sender = sender[0] if not self.receivers: return [] else: return [(receiver, receiver(sender, **kwargs)) for receiver in self.receivers_for(sender)] def has_receivers_for(self, sender): """True if there is probably a receiver for *sender*. Performs an optimistic check only. Does not guarantee that all weakly referenced receivers are still alive. See :meth:`receivers_for` for a stronger search. """ if not self.receivers: return False if self._by_sender[ANY_ID]: return True if sender is ANY: return False return hashable_identity(sender) in self._by_sender def receivers_for(self, sender): """Iterate all live receivers listening for *sender*.""" # TODO: test receivers_for(ANY) if self.receivers: sender_id = hashable_identity(sender) if sender_id in self._by_sender: ids = (self._by_sender[ANY_ID] | self._by_sender[sender_id]) else: ids = self._by_sender[ANY_ID].copy() for receiver_id in ids: receiver = self.receivers.get(receiver_id) if receiver is None: continue if isinstance(receiver, WeakTypes): strong = receiver() if strong is None: self._disconnect(receiver_id, ANY_ID) continue receiver = strong yield receiver def disconnect(self, receiver, sender=ANY): """Disconnect *receiver* from this signal's events. :param receiver: a previously :meth:`connected` callable :param sender: a specific sender to disconnect from, or :obj:`ANY` to disconnect from all senders. Defaults to ``ANY``. """ if sender is ANY: sender_id = ANY_ID else: sender_id = hashable_identity(sender) receiver_id = hashable_identity(receiver) self._disconnect(receiver_id, sender_id) if ('receiver_disconnected' in self.__dict__ and self.receiver_disconnected.receivers): self.receiver_disconnected.send(self, receiver=receiver, sender=sender) def _disconnect(self, receiver_id, sender_id): if sender_id == ANY_ID: if self._by_receiver.pop(receiver_id, False): for bucket in self._by_sender.values(): bucket.discard(receiver_id) self.receivers.pop(receiver_id, None) else: self._by_sender[sender_id].discard(receiver_id) self._by_receiver[receiver_id].discard(sender_id) def _cleanup_receiver(self, receiver_ref): """Disconnect a receiver from all senders.""" self._disconnect(receiver_ref.receiver_id, ANY_ID) def _cleanup_sender(self, sender_ref): """Disconnect all receivers from a sender.""" sender_id = sender_ref.sender_id assert sender_id != ANY_ID self._weak_senders.pop(sender_id, None) for receiver_id in self._by_sender.pop(sender_id, ()): self._by_receiver[receiver_id].discard(sender_id) def _cleanup_bookkeeping(self): """Prune unused sender/receiver bookeeping. Not threadsafe. Connecting & disconnecting leave behind a small amount of bookeeping for the receiver and sender values. Typical workloads using Blinker, for example in most web apps, Flask, CLI scripts, etc., are not adversely affected by this bookkeeping. With a long-running Python process performing dynamic signal routing with high volume- e.g. connecting to function closures, "senders" are all unique object instances, and doing all of this over and over- you may see memory usage will grow due to extraneous bookeeping. (An empty set() for each stale sender/receiver pair.) This method will prune that bookeeping away, with the caveat that such pruning is not threadsafe. The risk is that cleanup of a fully disconnected receiver/sender pair occurs while another thread is connecting that same pair. If you are in the highly dynamic, unique receiver/sender situation that has lead you to this method, that failure mode is perhaps not a big deal for you. """ for mapping in (self._by_sender, self._by_receiver): for _id, bucket in list(mapping.items()): if not bucket: mapping.pop(_id, None) def _clear_state(self): """Throw away all signal state. Useful for unit tests.""" self._weak_senders.clear() self.receivers.clear() self._by_sender.clear() self._by_receiver.clear() receiver_connected = Signal("""\ Sent by a :class:`Signal` after a receiver connects. :argument: the Signal that was connected to :keyword receiver_arg: the connected receiver :keyword sender_arg: the sender to connect to :keyword weak_arg: true if the connection to receiver_arg is a weak reference .. deprecated:: 1.2 As of 1.2, individual signals have their own private :attr:`~Signal.receiver_connected` and :attr:`~Signal.receiver_disconnected` signals with a slightly simplified call signature. This global signal is planned to be removed in 1.6. """) class NamedSignal(Signal): """A named generic notification emitter.""" def __init__(self, name, doc=None): Signal.__init__(self, doc) #: The name of this signal. self.name = name def __repr__(self): base = Signal.__repr__(self) return "%s; %r>" % (base[:-1], self.name) class Namespace(dict): """A mapping of signal names to signals.""" def signal(self, name, doc=None): """Return the :class:`NamedSignal` *name*, creating it if required. Repeated calls to this function will return the same signal object. """ try: return self[name] except KeyError: return self.setdefault(name, NamedSignal(name, doc)) class WeakNamespace(WeakValueDictionary): """A weak mapping of signal names to signals. Automatically cleans up unused Signals when the last reference goes out of scope. This namespace implementation exists for a measure of legacy compatibility with Blinker <= 1.2, and may be dropped in the future. .. versionadded:: 1.3 """ def signal(self, name, doc=None): """Return the :class:`NamedSignal` *name*, creating it if required. Repeated calls to this function will return the same signal object. """ try: return self[name] except KeyError: return self.setdefault(name, NamedSignal(name, doc)) signal = Namespace().signal PK03]ѨPMM __pycache__/base.cpython-311.pycnu[ ]j?dZddlmZddlmZddlmZmZmZm Z m Z m Z m Z e dZ de _dZGddeZed ZGd d eZGd d eZGddeZejZdS)a+Signals and events. A small implementation of signals, inspired by a snippet of Django signal API client code seen in a blog post. Signals are first-class objects and each manages its own receivers and message emission. The :func:`signal` function provides singleton behavior for named signals. )warn)WeakValueDictionary) WeakTypescontextmanager defaultdicthashable_identity lazy_property referencesymbolANYzToken for "any sender".ceZdZdZeZedZedZddZedfdZ dd Z e efd Z efd Z d Zd ZdZefdZdZdZdZdZdZdS)SignalzA notification emitter.c"tdS)zEmitted after each :meth:`connect`. The signal sender is the signal instance, and the :meth:`connect` arguments are passed through: *receiver*, *sender*, and *weak*. .. versionadded:: 1.2 z"Emitted after a receiver connects.docrselfs l/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/blinker/base.pyreceiver_connectedzSignal.receiver_connected%s>????c"tdS)a Emitted after :meth:`disconnect`. The sender is the signal instance, and the :meth:`disconnect` arguments are passed through: *receiver* and *sender*. Note, this signal is emitted **only** when :meth:`disconnect` is called explicitly. The disconnect signal can not be emitted by an automatic disconnect (due to a weakly referenced receiver or sender going out of scope), as the receiver and/or sender instances are no longer available for use at the time this signal would be emitted. An alternative approach is available by subscribing to :attr:`receiver_connected` and setting up a custom weakref cleanup callback on weak receivers and senders. .. versionadded:: 1.2 z%Emitted after a receiver disconnects.rrrs rreceiver_disconnectedzSignal.receiver_disconnected1s,ABBBBrNc|r||_i|_tt|_tt|_i|_dS)zt :param doc: optional. If provided, will be assigned to the signal's __doc__ attribute. N)__doc__ receiversrset _by_receiver _by_sender _weak_senders)rrs r__init__zSignal.__init__IsI  DL',,%c**rTcZt|}|rt||j}||_n|}|turt }nt|}|j|||j| ||j | |~|turS||j vrJ t||j }||_ |j ||~n#t$rYnwxYwd|jvrH|jjr< |j||||n#|||xYwt jrE|t ur< t ||||n#|||xYw|S)aaConnect *receiver* to signal events sent by *sender*. :param receiver: A callable. Will be invoked by :meth:`send` with `sender=` as a single positional argument and any \*\*kwargs that were provided to a call to :meth:`send`. :param sender: Any object or :obj:`ANY`, defaults to ``ANY``. Restricts notifications delivered to *receiver* to only those :meth:`send` emissions sent by *sender*. If ``ANY``, the receiver will always be notified. A *receiver* may be connected to multiple *sender* values on the same Signal through multiple calls to :meth:`connect`. :param weak: If true, the Signal will hold a weakref to *receiver* and automatically disconnect when *receiver* goes out of scope or is garbage collected. Defaults to True. r)receiversenderweak) receiver_arg sender_argweak_arg)rr _cleanup_receiver receiver_idr ANY_IDr setdefaultraddrr _cleanup_sender sender_id TypeError__dict__rsend disconnect)rr#r$r%r* receiver_refr/ sender_refs rconnectzSignal.connect\s&(11  $$Xt/EFFL'2L $ $#L S==II)&11I !!+|<<<  "&&{333 +&**9555    $2D!D!D &vt/CDD '0 $"--iDDDJ      !DM 1 1  # - 2 ',,T6>4:26-8888 &111  ' D8J,J,J "''5=3915(7777 &111s*C99 DDD>>E0FF(Fcfd}|S)aKConnect the decorated function as a receiver for *sender*. :param sender: Any object or :obj:`ANY`. The decorated function will only receive :meth:`send` emissions sent by *sender*. If ``ANY``, the receiver will always be notified. A function may be decorated multiple times with differing *sender* values. :param weak: If true, the Signal will hold a weakref to the decorated function and automatically disconnect when *receiver* goes out of scope or is garbage collected. Unlike :meth:`connect`, this defaults to False. The decorated function will be invoked by :meth:`send` with `sender=` as a single positional argument and any \*\*kwargs that were provided to the call to :meth:`send`. .. versionadded:: 1.1 c6||SN)r6)fnrr$r%s r decoratorz%Signal.connect_via..decorators LLVT * * *Ir)rr$r%r;s``` r connect_viazSignal.connect_vias0*       rc#K|||d dV||dS#||xYw)aExecute a block with the signal temporarily connected to *receiver*. :param receiver: a receiver callable :param sender: optional, a sender to filter on This is a context manager for use in the ``with`` statement. It can be useful in unit tests. *receiver* is connected to the signal for the duration of the ``with`` block, and will be disconnected automatically when exiting the block: .. testsetup:: from __future__ import with_statement from blinker import Signal on_ready = Signal() receiver = lambda sender: None .. testcode:: with on_ready.connected_to(receiver): # do stuff on_ready.send(123) .. versionadded:: 1.1 F)r$r%N)r6r3rr#r$s r connected_tozSignal.connected_tosf8 Xf5 999 &JJJ OOH % % % % %   OOH % % % s 7AcXtdt|||S)agAn alias for :meth:`connected_to`. :param receiver: a receiver callable :param sender: optional, a sender to filter on .. versionadded:: 0.9 .. versionchanged:: 1.1 Renamed to :meth:`connected_to`. ``temporarily_connected_to`` was deprecated in 1.2 and will be removed in a subsequent version. zAtemporarily_connected_to is deprecated; use connected_to instead.)rDeprecationWarningr@r?s rtemporarily_connected_tozSignal.temporarily_connected_tos6 )  ! ! !  6222rctdkrdn:tdkrtdtzd|jsgSfd|DS)aEmit this signal on behalf of *sender*, passing on \*\*kwargs. Returns a list of 2-tuples, pairing receivers with their return value. The ordering of receiver notification is undefined. :param \*sender: Any object or ``None``. If omitted, synonymous with ``None``. Only accepts one positional argument. :param \*\*kwargs: Data to be sent to receivers. rNz5send() accepts only one positional argument, %s givenc&g|] }||fifSr<r<).0r#kwargsr$s r zSignal.send.. sF@@@ xx99&99:@@@r)lenr0r receivers_for)rr$rHs ``rr2z Signal.sends v;;!  FF [[1__'),V566 6AYF~ @I@@@@@$($6$6v$>$>@@@ @rc~|jsdS|jtrdS|turdSt ||jvS)zTrue if there is probably a receiver for *sender*. Performs an optimistic check only. Does not guarantee that all weakly referenced receivers are still alive. See :meth:`receivers_for` for a stronger search. FT)rrr+r r)rr$s rhas_receivers_forzSignal.has_receivers_for sJ~ 5 ?6 " 4 S==5 ((DO;;rc#K|jrt|}||jvr!|jt|j|z}n$|jt}|D]d}|j|}|t |tr*|}|||t\|}|VcdSdS)z2Iterate all live receivers listening for *sender*.N) rrrr+copyget isinstancer _disconnect)rr$r/idsr*r#strongs rrKzSignal.receivers_fors > )&11IDO++v.y12of-2244"   >--k::#h 22&%XZZF~((f=== %H#    rc|turt}nt|}t|}|||d|jvr+|jjr!|j|||dSdSdS)aDisconnect *receiver* from this signal's events. :param receiver: a previously :meth:`connected` callable :param sender: a specific sender to disconnect from, or :obj:`ANY` to disconnect from all senders. Defaults to ``ANY``. r)r#r$N)r r+rrRr1rrr2)rr#r$r/r*s rr3zSignal.disconnect3s S==II)&11I'11  i000 #t} 4 4  & 0 5  & + +D5=39 , ; ; ; ; ; 5 4 4 4rcn|tkri|j|dr1|jD]}|||j|ddS|j|||j||dS)NF)r+rpoprvaluesdiscardr)rr*r/buckets rrRzSignal._disconnectIs    $$[%88 0"o446600FNN;//// N  {D 1 1 1 1 1 OI & . .{ ; ; ;  k * 2 29 = = = = =rcF||jtdS)z'Disconnect a receiver from all senders.N)rRr*r+)rr4s rr)zSignal._cleanup_receiverSs! 16:::::rc|j}|tksJ|j|d|j|dD]"}|j||#dS)z'Disconnect all receivers from a sender.Nr<)r/r+r rWrrrY)rr5r/r*s rr.zSignal._cleanup_senderWs~( F"""" y$///?..y"== > >K  k * 2 29 = = = = > >rc|j|jfD]A}t|D]\}}|s||dBdS)anPrune unused sender/receiver bookeeping. Not threadsafe. Connecting & disconnecting leave behind a small amount of bookeeping for the receiver and sender values. Typical workloads using Blinker, for example in most web apps, Flask, CLI scripts, etc., are not adversely affected by this bookkeeping. With a long-running Python process performing dynamic signal routing with high volume- e.g. connecting to function closures, "senders" are all unique object instances, and doing all of this over and over- you may see memory usage will grow due to extraneous bookeeping. (An empty set() for each stale sender/receiver pair.) This method will prune that bookeeping away, with the caveat that such pruning is not threadsafe. The risk is that cleanup of a fully disconnected receiver/sender pair occurs while another thread is connecting that same pair. If you are in the highly dynamic, unique receiver/sender situation that has lead you to this method, that failure mode is perhaps not a big deal for you. N)rrlistitemsrW)rmapping_idrZs r_cleanup_bookkeepingzSignal._cleanup_bookkeeping_sl*):; + +G#GMMOO44 + + V+KKT*** + + +rc|j|j|j|jdS)z4Throw away all signal state. Useful for unit tests.N)r clearrrrrs r _clear_statezSignal._clear_stateysZ   """   !!!!!rr9)F)__name__ __module__ __qualname__rr r rrr!r6r=rr@rCr2rMrKr3rRr)r.rbrer<rrrrst!! C @ @] @CC]C.    &(+BBBBH4,/"&"&"&^"&H9<3333$@@@8<<< ,+.;;;;,>>>;;;>>>+++4"""""rra Sent by a :class:`Signal` after a receiver connects. :argument: the Signal that was connected to :keyword receiver_arg: the connected receiver :keyword sender_arg: the sender to connect to :keyword weak_arg: true if the connection to receiver_arg is a weak reference .. deprecated:: 1.2 As of 1.2, individual signals have their own private :attr:`~Signal.receiver_connected` and :attr:`~Signal.receiver_disconnected` signals with a slightly simplified call signature. This global signal is planned to be removed in 1.6. c eZdZdZddZdZdS) NamedSignalz%A named generic notification emitter.NcJt||||_dSr9)rr!namerrlrs rr!zNamedSignal.__init__s#c""" rc`t|}|ddd|jdS)Nz; >)r__repr__rl)rbases rrqzNamedSignal.__repr__s0t$$ "IIItyyy11rr9)rfrgrhrr!rqr<rrrjrjs=// 22222rrjceZdZdZddZdS) Namespacez%A mapping of signal names to signals.Nc| ||S#t$r'||t||cYSwxYwzReturn the :class:`NamedSignal` *name*, creating it if required. Repeated calls to this function will return the same signal object. KeyErrorr,rjrms rsignalzNamespace.signalU  A:  A A A??4T3)?)?@@ @ @ @ A  .;;r9rfrgrhrryr<rrrtrts4// A A A A A ArrtceZdZdZddZdS) WeakNamespacea-A weak mapping of signal names to signals. Automatically cleans up unused Signals when the last reference goes out of scope. This namespace implementation exists for a measure of legacy compatibility with Blinker <= 1.2, and may be dropped in the future. .. versionadded:: 1.3 Nc| ||S#t$r'||t||cYSwxYwrvrwrms rryzWeakNamespace.signalrzr{r9r|r<rrr~r~s8 A A A A A Arr~N)rwarningsrweakrefrblinker._utilitiesrrrrr r r r r+objectrrrjdictrtr~ryr<rrrs'''''' fUmm' `"`"`"`"`"V`"`"`"F V$ 2 2 2 2 2& 2 2 2 A A A A A A A AAAAAA'AAA.  rPK03]rH''$__pycache__/_saferef.cpython-311.pycnu[ ]j$ dZddlZddlZddlZddlZ en#e$rdZYnwxYwejdkr!ejdZ ejdZ n ejdZ ejdZ d d Z Gd d e Z dS) z-Refactored 'safe reference from dispatcher.pyNc"t|dS)N__call__)hasattr)objects p/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/blinker/_saferef.pycallabler.svz***)im_selfim_func__self____func__c> t|}|@t|dst|ds Jd|zt||}|SdS#t$r=t |rt j||cYSt j|cYSwxYw)aReturn a *safe* weak reference to a callable target. - ``target``: The object to be weakly referenced, if it's a bound method reference, will create a BoundMethodWeakref, otherwise creates a simple weakref. - ``on_delete``: If provided, will have a hard reference stored to the callable to be called after the safe reference goes out of scope with the reference object, (either a weakref or a BoundMethodWeakref) as argument. Nr rzRsafe_ref target %r has im_self, but no im_func, don't know how to create reference)target on_delete)get_selfrBoundMethodWeakrefAttributeErrorrweakrefref)rrr references rsafe_refr:s6""  69-- ?1L1L ? ?57=> ? ?L+&INNNI    ''' I   ';vy11 1 1 1;v&& & & & 'sA.BBBceZdZdZejZd fd Zd dZdZ e e Z dZ e Z dZ dZd ZxZS) ra'Safe' and reusable weak references to instance methods. BoundMethodWeakref objects provide a mechanism for referencing a bound method without requiring that the method object itself (which is normally a transient object) is kept alive. Instead, the BoundMethodWeakref object keeps weak references to both the object and the function which together define the instance method. Attributes: - ``key``: The identity key for the reference, calculated by the class's calculate_key method applied to the target instance method. - ``deletion_methods``: Sequence of callable objects taking single argument, a reference to this object which will be called when *either* the target object or target function is garbage collected (i.e. when this object becomes invalid). These are specified as the on_delete parameters of safe_ref calls. - ``weak_self``: Weak reference to the target object. - ``weak_func``: Weak reference to the target function. Class Attributes: - ``_all_instances``: Class attribute pointing to all live BoundMethodWeakref objects indexed by the class's calculate_key(target) method applied to the target objects. This weak value dictionary is used to short-circuit creation so that multiple references to the same (object, function) pair produce the same BoundMethodWeakref instance. Nc*||}|j|}||j||St t ||}||j|<|j||g|Ri||S)aCreate new instance or return current instance. Basically this method of construction allows us to short-circuit creation of references to already- referenced instance methods. The key corresponding to the target is calculated, and if there is already an existing reference, that is returned, with its deletion_methods attribute updated. Otherwise the new instance is created and registered in the table of already-referenced methods. ) calculate_key_all_instancesgetdeletion_methodsappendsuperr__new____init__) clsrr argumentsnamedkeycurrentbase __class__s rr!zBoundMethodWeakref.__new__|s''$((--    $ + +I 6 6 6N+S1199#>>D&*C s # DM&) Ai A A A5 A A AKr cR|fd}|g|_|||_t|}t |}t j|||_t j|||_t||_ t|j |_ dS)aReturn a weak-reference-like instance for a bound method. - ``target``: The instance-method target for the weak reference, must have im_self and im_func attributes and be reconstructable via the following, which is true of built-in instance methods:: target.im_func.__get__( target.im_self ) - ``on_delete``: Optional callback which will be called when this weak reference ceases to be valid (i.e. either the object or the function is garbage collected). Should take a single argument, which will be passed a pointer to this object. c |jdd}|jdd= |jj|j=n#t$rYnwxYw|D]} t |r ||#t $rY tjnA#t$r4tj d}td|d|d|YnwxYwYwxYwdS)z=Set self.isDead to True when method or instance is destroyed.NzException during saferef z cleanup function z: ) rr)rr&KeyErrorr Exception traceback print_excrsysexc_infoprint)weakselfmethodsfunctiones rremovez+BoundMethodWeakref.__init__..removes<+AAA.G%aaa( N1$(;;    # P P P))'  PPPP!+----)PPPLNN1-<@DD(((AA OPPPPPPP P PsB. ;;A C)A=<C=;B;8C:B;;CCN) rrr&rget_funcrr weak_self weak_funcstr self_name__name__ func_name)r5rrr9r r s rr"zBoundMethodWeakref.__init__s # P P P P&"+ %%f--6""6"" Wf55 Wf55WW-..r crtt|tt|fS)zCalculate the reference key for this reference. Currently this is a two-tuple of the id()'s of the target object and the target function respectively. )idrr:)r#rs rrz BoundMethodWeakref.calculate_keys/ 8F##$$b&)9)9&:&:;;r c@|jjd|jd|jdS)z-Give a friendly representation of the object.(.))r)r?r>r@r5s r__str__zBoundMethodWeakref.__str__s. N # # # NNN NNN r c|duS)z'Whether we are still a valid reference.NrGs r __nonzero__zBoundMethodWeakref.__nonzero__stvvT!!r ct||js"t|jt|St|j|jS)zCompare with another reference.) isinstancer)cmptyper&)r5others r__cmp__zBoundMethodWeakref.__cmp__sB%00 4t~tE{{33 348UY'''r c|}|+|}|||SdS)a?Return a strong reference to the bound method. If the target cannot be retrieved, then will return None, otherwise returns a bound instance method for our object and function. Note: You may call this method any number of times, as it does not invalidate the reference. N)r;r<__get__)r5rr7s rrzBoundMethodWeakref.__call__sG!!  ~~''H#''///tr N)r? __module__ __qualname____doc__rWeakValueDictionaryrr!r"r classmethodrH__repr__rKrQr __classcell__)r)s@rrrXsB1W022N,*/*/*/*/X<<< K ..MH"""((( r rrT)rWoperatorr1r/rr NameError version_info attrgetterrr:rrrrJr rr`s!F43 + HH+++++++++ d"x"9--H"x"9--HH"x":..H"x":..Ht||j|Sr)r rr&s r r%zdefaultdict.__copy__/s4::d2D99 9r cddl}t||j||S)Nr)r'r rdeepcopyr!)rmemor's r __deepcopy__zdefaultdict.__deepcopy__2sA KKK4::d2"mmDJJLL99;; ;r cNd|jdt|dS)Nz defaultdict(z, ))rr__repr__r&s r r/zdefaultdict.__repr__7s1,0,@,@,@,0MM$,?,?,?,?A Ar r) __name__ __module__ __qualname__rrrr#r'r%r,r/r r r r s 3 3 3 3 - - -      > > > # # # : : : ; ; ;  A A A A Ar r )contextmanagerc$d}|j|_|S)Nc td)Nz8Python 2.5 or above is required to use context managers.) RuntimeError)r"rs r oopszcontextmanager..oops@s 344 4r )r0)fnr8s r r4r4?s! 4 4 4   r c eZdZdZdZdZdS)_symbolc"|x|_|_dS)zConstruct a new named symbol.N)r0name)rr=s r rz_symbol.__init__Hs$((  r c t|jffSr)symbolr=r&s r r#z_symbol.__reduce__Ls |##r c|jSr)r=r&s r r/z_symbol.__repr__Os yr N)r0r1r2rr#r/r3r r r;r;FsA)))$$$r r;r?ceZdZdZiZdZdS)r?a?A constant symbol. >>> symbol('foo') is symbol('foo') True >>> symbol('foo') foo A slight refinement of the MAGICCOOKIE=object() pattern. The primary advantage of symbol() is its repr(). They are also singletons. Repeated calls of symbol('name') will all return the same instance. c |j|S#t$r+|j|t|cYSwxYwr)symbolsr setdefaultr;)clsr=s r __new__zsymbol.__new__dsS ?;t$ $ ? ? ?;))$ >> > > > ?s 2AAN)r0r1r2__doc__rCrFr3r r r?r?Ts4  G?????r c.t|dr(t|jt|jfSt|dr(t|jt|jfSt |tr|St|S)N__func__im_func)ridrI__self__rJim_self isinstancetext)objs r hashable_identityrQqssJ3<  "S\"2"233 i 3;CK11 C   #wwr ceZdZdZdS)annotatable_weakrefz7A weakref.ref that supports custom instance attributes.N)r0r1r2rGr3r r rSrSsAAAAr rSNc t|rt||}nt||}|D]\}}t ||||S)zReturn an annotated weak ref.)r callable_referencerSr!setattr)rcallback annotationsweakrrs r referencerZsk5!&(33"6844!''))"" Uc5!!!! Kr ct|dr|jt||St|dr|jt||St ||S)z@Return an annotated weak ref, supporting bound instance methods.rMN)target on_deleterL)rrMrrLrS)rrWs r rUrUslvy!!Efn&@!8DDDD  $ $E)D!8DDDD vx 0 00r ceZdZdZdZdZdS) lazy_propertyz(A @property that is only evaluated once.c,||_|j|_dSr) _deferredrG)rdeferreds r rzlazy_property.__init__s!' r cn||S||}t||jj||Sr)rarVr0)rrPrErs r __get__zlazy_property.__get__s9 ;Ks##T^,e444 r N)r0r1r2rGrrdr3r r r_r_s822(((r r_r)weakrefrblinker._saferefrr NameError collectionsr r contextlibr4 ImportErrorrr;r0r?strunicoderOrQ WeakTypesrSrZrUr_r3r r rnsW//////+ HH+++++++++ ,A'''''''*A)A)A)A)A)Ad)A)A)A)A)AX)))))))     f   ?????V???. >DD DDD$ % BBBBB#BBB1111     F     s7'9AAA6A;;BBPK03]R$__pycache__/__init__.cpython-311.pycnu[ ]j,6ddlmZmZmZmZmZmZmZgdZdZ dS))ANY NamedSignal NamespaceSignal WeakNamespacereceiver_connectedsignalz1.4N) blinker.baserrrrrrr __all__ __version__p/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/blinker/__init__.pyrs{    rPK03]):m$$ _saferef.pynu[# extracted from Louie, http://pylouie.org/ # updated for Python 3 # # Copyright (c) 2006 Patrick K. O'Brien, Mike C. Fletcher, # Matthew R. Scott # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following # disclaimer in the documentation and/or other materials provided # with the distribution. # # * Neither the name of the nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # """Refactored 'safe reference from dispatcher.py""" import operator import sys import traceback import weakref try: callable except NameError: def callable(object): return hasattr(object, '__call__') if sys.version_info < (3,): get_self = operator.attrgetter('im_self') get_func = operator.attrgetter('im_func') else: get_self = operator.attrgetter('__self__') get_func = operator.attrgetter('__func__') def safe_ref(target, on_delete=None): """Return a *safe* weak reference to a callable target. - ``target``: The object to be weakly referenced, if it's a bound method reference, will create a BoundMethodWeakref, otherwise creates a simple weakref. - ``on_delete``: If provided, will have a hard reference stored to the callable to be called after the safe reference goes out of scope with the reference object, (either a weakref or a BoundMethodWeakref) as argument. """ try: im_self = get_self(target) except AttributeError: if callable(on_delete): return weakref.ref(target, on_delete) else: return weakref.ref(target) else: if im_self is not None: # Turn a bound method into a BoundMethodWeakref instance. # Keep track of these instances for lookup by disconnect(). assert hasattr(target, 'im_func') or hasattr(target, '__func__'), ( "safe_ref target %r has im_self, but no im_func, " "don't know how to create reference" % target) reference = BoundMethodWeakref(target=target, on_delete=on_delete) return reference class BoundMethodWeakref(object): """'Safe' and reusable weak references to instance methods. BoundMethodWeakref objects provide a mechanism for referencing a bound method without requiring that the method object itself (which is normally a transient object) is kept alive. Instead, the BoundMethodWeakref object keeps weak references to both the object and the function which together define the instance method. Attributes: - ``key``: The identity key for the reference, calculated by the class's calculate_key method applied to the target instance method. - ``deletion_methods``: Sequence of callable objects taking single argument, a reference to this object which will be called when *either* the target object or target function is garbage collected (i.e. when this object becomes invalid). These are specified as the on_delete parameters of safe_ref calls. - ``weak_self``: Weak reference to the target object. - ``weak_func``: Weak reference to the target function. Class Attributes: - ``_all_instances``: Class attribute pointing to all live BoundMethodWeakref objects indexed by the class's calculate_key(target) method applied to the target objects. This weak value dictionary is used to short-circuit creation so that multiple references to the same (object, function) pair produce the same BoundMethodWeakref instance. """ _all_instances = weakref.WeakValueDictionary() def __new__(cls, target, on_delete=None, *arguments, **named): """Create new instance or return current instance. Basically this method of construction allows us to short-circuit creation of references to already- referenced instance methods. The key corresponding to the target is calculated, and if there is already an existing reference, that is returned, with its deletion_methods attribute updated. Otherwise the new instance is created and registered in the table of already-referenced methods. """ key = cls.calculate_key(target) current = cls._all_instances.get(key) if current is not None: current.deletion_methods.append(on_delete) return current else: base = super(BoundMethodWeakref, cls).__new__(cls) cls._all_instances[key] = base base.__init__(target, on_delete, *arguments, **named) return base def __init__(self, target, on_delete=None): """Return a weak-reference-like instance for a bound method. - ``target``: The instance-method target for the weak reference, must have im_self and im_func attributes and be reconstructable via the following, which is true of built-in instance methods:: target.im_func.__get__( target.im_self ) - ``on_delete``: Optional callback which will be called when this weak reference ceases to be valid (i.e. either the object or the function is garbage collected). Should take a single argument, which will be passed a pointer to this object. """ def remove(weak, self=self): """Set self.isDead to True when method or instance is destroyed.""" methods = self.deletion_methods[:] del self.deletion_methods[:] try: del self.__class__._all_instances[self.key] except KeyError: pass for function in methods: try: if callable(function): function(self) except Exception: try: traceback.print_exc() except AttributeError: e = sys.exc_info()[1] print ('Exception during saferef %s ' 'cleanup function %s: %s' % (self, function, e)) self.deletion_methods = [on_delete] self.key = self.calculate_key(target) im_self = get_self(target) im_func = get_func(target) self.weak_self = weakref.ref(im_self, remove) self.weak_func = weakref.ref(im_func, remove) self.self_name = str(im_self) self.func_name = str(im_func.__name__) def calculate_key(cls, target): """Calculate the reference key for this reference. Currently this is a two-tuple of the id()'s of the target object and the target function respectively. """ return (id(get_self(target)), id(get_func(target))) calculate_key = classmethod(calculate_key) def __str__(self): """Give a friendly representation of the object.""" return "%s(%s.%s)" % ( self.__class__.__name__, self.self_name, self.func_name, ) __repr__ = __str__ def __nonzero__(self): """Whether we are still a valid reference.""" return self() is not None def __cmp__(self, other): """Compare with another reference.""" if not isinstance(other, self.__class__): return cmp(self.__class__, type(other)) return cmp(self.key, other.key) def __call__(self): """Return a strong reference to the bound method. If the target cannot be retrieved, then will return None, otherwise returns a bound instance method for our object and function. Note: You may call this method any number of times, as it does not invalidate the reference. """ target = self.weak_self() if target is not None: function = self.weak_func() if function is not None: return function.__get__(target) return None PK03]x2@,, __init__.pynu[from blinker.base import ( ANY, NamedSignal, Namespace, Signal, WeakNamespace, receiver_connected, signal, ) __all__ = [ 'ANY', 'NamedSignal', 'Namespace', 'Signal', 'WeakNamespace', 'receiver_connected', 'signal', ] __version__ = '1.4' PK03]ii _utilities.pynu[PK03]Lu??base.pynu[PK03]ѨPMM Q__pycache__/base.cpython-311.pycnu[PK03]rH''$__pycache__/_saferef.cpython-311.pycnu[PK03]8m"m"&__pycache__/_utilities.cpython-311.pycnu[PK03]R$__pycache__/__init__.cpython-311.pycnu[PK03]):m$$ %_saferef.pynu[PK03]x2@,, g__init__.pynu[PK