
    ~i"'                         d Z ddlmZ ddlmZ  G d de      Zd Zd Zd Zd	 Z	d
 Z
d Zd Zd Zd Zd Zd Z G d de      Z G d de      ZddZy)z0Variants of ObjectProxy for different use cases.   )BaseObjectProxy)synchronizedc                   8     e Zd ZdZed        Z fdZd Z xZS )ObjectProxya  A generic object proxy which forwards special methods as needed.
    For backwards compatibility this class adds support for `__iter__()`. If
    you don't need backward compatibility for `__iter__()` support then it is
    preferable to use `BaseObjectProxy` directly. If you want automatic
    support for special dunder methods for callables, iterators, and async,
    then use `AutoObjectProxy`.c                     t         S N)r   selfs    a/var/www/catia.catastroantioquia-mas.com/valormasv2/lib/python3.12/site-packages/wrapt/proxies.py__object_proxy__zObjectProxy.__object_proxy__   s        c                 "    t         |   |       S r   super__new__)clsargskwargs	__class__s      r   r   zObjectProxy.__new__   s    ws##r   c                 ,    t        | j                        S r   iter__wrapped__r	   s    r   __iter__zObjectProxy.__iter__   s    D$$%%r   )	__name__
__module____qualname____doc__propertyr   r   r   __classcell__r   s   @r   r   r   
   s&    #  $&r   r   c                 &     | j                   |i |S r   )r   )r
   r   r   s      r   __wrapper_call__r#   !   s    4T,V,,r   c                 ,    t        | j                        S r   r   r	   s    r   __wrapper_iter__r%   %   s      !!r   c                 6    | j                   j                         S r   )r   __next__r	   s    r   __wrapper_next__r(   )   s    $$&&r   c                 6    | j                   j                         S r   )r   	__aiter__r	   s    r   __wrapper_aiter__r+   -   s    %%''r   c                 R   K   | j                   j                          d {   S 7 wr   )r   	__anext__r	   s    r   __wrapper_anext__r.   1   s!     !!++----   '%'c                 6    | j                   j                         S r   )r   __length_hint__r	   s    r   __wrapper_length_hint__r2   5   s    ++--r   c              #   R   K   | j                   j                         E d {   S 7 wr   )r   	__await__r	   s    r   __wrapper_await__r5   9   s!     ''113343r/   c                 :    | j                   j                  ||      S r   )r   __get__)r
   instanceowners      r   __wrapper_get__r:   =       ##He44r   c                 :    | j                   j                  ||      S r   )r   __set__)r
   r8   values      r   __wrapper_set__r?   A   r;   r   c                 8    | j                   j                  |      S r   )r   
__delete__)r
   r8   s     r   __wrapper_delete__rB   E   s    &&x00r   c                 :    | j                   j                  ||      S r   )r   __set_name__)r
   r9   names      r   __wrapper_set_name__rF   I   s    ((55r   c                   (     e Zd ZdZ fdZd Z xZS )AutoObjectProxya  An object proxy which can automatically adjust to the wrapped object
    and add special dunder methods as needed. Note that this creates a new
    class for each instance, so it has much higher memory overhead than using
    `BaseObjectProxy` directly. If you know what special dunder methods you need
    then it is preferable to use `BaseObjectProxy` directly and add them to a
    subclass as needed. If you only need `__iter__()` support for backwards
    compatibility then use `ObjectProxy` instead.
    c                 H   i }t        |      }t        t        |             }t        |      rd|vr	t        |d<   d|v rd|vr	t        |d<   d|v rd|vr	t
        |d<   d|v rd|vr	t        |d<   d|v rd|vr	t        |d<   d|v rd|vr	t        |d<   d|v rd|vr	t        |d<   d|v rd|vr	t        |d<   d	|v rd	|vr	t        |d	<   d
|v rd
|vr	t        |d
<   d|v rd|vr	t        |d<   | j                  }| t        u rt         j                  }t"        | I  t'        || f|            S )zzInjects special dunder methods into a dynamically created subclass
        as needed based on the wrapped object.
        __call__r   r'   r*   r-   r1   r4   r7   r=   rA   rD   )dirsetcallabler#   r%   r(   r+   r.   r2   r5   r:   r?   rB   rF   r   rH   r   r   r   type)r   wrapped	namespacewrapped_attrsclass_attrsrE   r   s         r   r   zAutoObjectProxy.__new__W   sm   
 	G#c(mG;!>$4Ij!&:[+H$4Ij!&:[+H$4Ij!-'K{,J%6Ik"-'K{,J%6Ik"-2C;2V+BI'( -'K{,J%6Ik"%);*F#2Ii %);*F#2Ii =(\-L&8Il#]*~[/P(<In%||/!"++DwtD3&)<==r   c                 2   t        |       }t        t        |            }t        | j                        rd|vr+t
        |_        nt        |dd      t
        u rt        |d       t        | j                  d      rd|vr+t        |_        nt        |dd      t        u rt        |d       t        | j                  d      rd|vr+t        |_        nt        |dd      t        u rt        |d       t        | j                  d      rd|vr+t        |_        nt        |dd      t        u rt        |d       t        | j                  d      rd|vr+t         |_        nt        |dd      t         u rt        |d       t        | j                  d      rd|vr+t$        |_        nt        |dd      t$        u rt        |d       t        | j                  d      rd|vr+t(        |_        nt        |dd      t(        u rt        |d       t        | j                  d	      rd	|vr+t,        |_        nt        |d	d      t,        u rt        |d	       t        | j                  d
      rd
|vr+t0        |_        nt        |d
d      t0        u rt        |d
       t        | j                  d      rd|vr+t4        |_        nt        |dd      t4        u rt        |d       t        | j                  d      rd|vrt8        |_        yyt        |dd      t8        u rt        |d       yy)zAdjusts special dunder methods on the class as needed based on the
        wrapped object, when `__wrapped__` is changed.
        rJ   Nr   r'   r*   r-   r1   r4   r7   r=   rA   rD   )rN   rL   rK   rM   r   r#   rJ   getattrdelattrhasattrr%   r   r(   r'   r+   r*   r.   r-   r2   r1   r5   r4   r:   r7   r?   r=   rB   rA   rF   rD   )r
   r   rR   s      r   __wrapped_setattr_fixups__z*AutoObjectProxy.__wrapped_setattr_fixups__   s   
 4j#c(mD$$%,/S*d+/??C$4##Z0,/S*d+/??C$4##Z0,/S*d+/??C$4##[1+- 1S+t,0AAC%4##[1+- 1S+t,0AAC%4##%67 3&=#S+T26MMC*+4##[1+- 1S+t,0AAC%4##Y/+-S)T*o=C#4##Y/+-S)T*o=C#4##\2;.!3S,-1CCC&4##^4[0#7  1S.$/3GGC( Hr   )r   r   r   r   r   rW   r    r!   s   @r   rH   rH   M   s    4>lH)r   rH   c                   @     e Zd ZdZd fd	Zd fd	ZdZd Zd Z xZ	S )LazyObjectProxyzhAn object proxy which can generate/create the wrapped object on demand
    when it is first needed.
    c                 $    t         |   | d       S r   r   )r   callbackr   s     r   r   zLazyObjectProxy.__new__   s    wsD))r   c                 6    ||| _         t        | 	  d       y)a  Initialize the object proxy with wrapped object as `None` but due
        to presence of special `__wrapped_factory__` attribute addded first,
        this will actually trigger the deferred creation of the wrapped object
        when first needed.
        N)__wrapped_factory__r   __init__)r
   r[   r   s     r   r^   zLazyObjectProxy.__init__   s      '/D$r   Fc                      y r    r	   s    r   r]   z#LazyObjectProxy.__wrapped_factory__   s    r   c                     t        t        |             5  | j                  r| j                  cddd       S | j	                         | _        d| _        | j                  cddd       S # 1 sw Y   yxY w)z2Gets the wrapped object, creating it if necessary.NT)r   rN   __wrapped_initialized__r   r]   r	   s    r   __wrapped_get__zLazyObjectProxy.__wrapped_get__   sg     $t*% 	$ ++''	$ 	$  $779D+/D(##	$ 	$ 	$s   A('A((A1r   )
r   r   r   r   r   r^   rb   r]   rc   r    r!   s   @r   rY   rY      s$    *
 $$r   rY   Nc                 (      fd}t        |      S )aN  Lazily imports the module `name`, returning a `LazyObjectProxy` which
    will import the module when it is first needed. When `name is a dotted name,
    then the full dotted name is imported and the last module is taken as the
    target. If `attribute` is provided then it is used to retrieve an attribute
    from the module.
    c                  @    t        dg      } t        |       S | S )N )fromlist)
__import__rT   )module	attributerE   s    r   _importzlazy_import.<locals>._import  s)    DB40 69--r   )rY   )rE   rj   rk   s   `` r   lazy_importrl   
  s     7##r   r   )r   	__wrapt__r   
decoratorsr   r   r#   r%   r(   r+   r.   r2   r5   r:   r?   rB   rF   rH   rY   rl   r`   r   r   <module>ro      sr    6 & $&/ &.-"'(..55516H)o H)V/$o /$d$r   