
    VeIi                     H    d dl Z d dlZddlmZmZ d Z G d de          ZdS )    N   )BaseObjectProxy_FunctionWrapperBasec                 D    |j         rd S d|_         | ||           d S d S )NT)_self_expired)refproxycallbacks      S/var/www/html/MCyber-Diagnostic/venv/lib/python3.11/site-packages/wrapt/weakrefs.py_weak_function_proxy_callbackr      s;     E      c                   .     e Zd ZdZdZd fd	Zd Z xZS )WeakFunctionProxyzA weak function proxy.)r   _self_instanceNc                 *   |ot          j        t          | |          }d| _        t	          |t
                    rt          j        |j        |          | _        |j	        At          t          |                               t          j        |j	        |                     n;t          t          |                               t          j        ||                     dS 	 t          j        |j        |          | _        t          t          |                               t          j        |j        |                     dS # t           $ rF d| _        t          t          |                               t          j        ||                     Y dS w xY w)a  Create a proxy to object which uses a weak reference. This is
        similar to the `weakref.proxy` but is designed to work with functions
        and methods. It will automatically rebind the function to the instance
        when called if the function was originally a bound method. This is
        necessary because bound methods are transient objects and applying a
        weak reference to one will immediately result in it being destroyed
        and the weakref callback called. The weak reference is therefore
        applied to the instance the method is bound to and the original
        function. The function is then rebound at the point of a call via the
        weak function proxy.
        )r	   r
   FN)	functoolspartialr   r   
isinstancer   weakrefr   r   _self_parentsuperr   __init__r	   __self____func__AttributeError)selfwrappedr
   	_callback	__class__s       r   r   zWeakFunctionProxy.__init__#   s   2  
!2)"
 "
 "
	 #g344 	")+g.Di"P"PD#/'..77M'"6	BB   
 '..77M'955   F
	W")+g.>	"J"JD#T**33g.	::      	W 	W 	W"&D#T**33GM'94U4UVVVVVV	Ws   !AE AFFc                      d } ||  \  }} |j         o|                                 }|j        o|j        }| |j        | i |S  |                    |t          |                    | i |S )Nc                 
    | |fS N )r   argss     r   _unpack_selfz0WeakFunctionProxy.__call__.<locals>._unpack_self^   s    :r   )r   __wrapped____get__type)r$   kwargsr%   r   instancefunctions         r   __call__zWeakFunctionProxy.__call__]   s    	 	 	 "\4(
d &@4+>+>+@+@#8(8 #4#T4V4449x$x..994J6JJJr   r"   )__name__
__module____qualname____doc__	__slots__r   r,   __classcell__)r   s   @r   r   r      se          3I8W 8W 8W 8W 8W 8WtK K K K K K Kr   r   )r   r   	__wrapt__r   r   r   r   r#   r   r   <module>r4      s         < < < < < < < <  TK TK TK TK TK TK TK TK TK TKr   