
    HAi&                     x    S SK r S SKrSSKJr  S rS rS0 4S jr " S S	5      rS0 4S
 jrS r	S r
SS jrS rg)    N   FunctionWrapperc                     [        U [        5      (       a  [        U 5        [        R                  U    n U nUR                  S5      nUS   nS nU" X$5      nUSS  H  nUnU" X$5      nM     X$U4$ )a  
Resolves the dotted path supplied as `name` to an attribute on a target
object. The `target` can be a module, class, or instance of a class. If the
`target` argument is a string, it is assumed to be the name of a module,
which will be imported if necessary and then used as the target object.
Returns a tuple containing the parent object holding the attribute lookup
resolved to, the attribute name (path prefix removed if present), and the
original attribute value.
.r   c                     [         R                  " U 5      (       aG  [         R                  " U 5       H"  nU[        U5      ;   d  M  [        U5      U   s  $    [	        X5      $ [	        X5      $ N)inspectisclassgetmrovarsgetattr)parent	attributeclss      I/var/www/html/land-ocr/venv/lib/python3.13/site-packages/wrapt/patches.pylookup_attribute&resolve_path.<locals>.lookup_attribute*   sW    ??6""~~f-S	)9Y// . v116--    r   N)
isinstancestr
__import__sysmodulessplit)targetnamer   pathr   r   originals          r   resolve_pathr    	   s     &#6V$F::c?DQI.  2H!"X	#F6  x((r   c                     [        XU5        g)z
Convenience function for applying a patch to an attribute. Currently this
maps to the standard setattr() function, but in the future may be extended
to support more complex patching strategies.
N)setattr)r   r   replacements      r   apply_patchr$   =   s     F{+r    c                 R    [        X5      u  pVnU" U/UQ70 UD6n[        XVU5        U$ )a  
Wraps an object which is the attribute of a target object with a wrapper
object created by the `factory` function. The `target` can be a module,
class, or instance of a class. In the special case of `target` being a
string, it is assumed to be the name of a module, with the module being
imported if necessary and then used as the target object. The `name` is a
string representing the dotted path to the attribute. The `factory` function
should accept the original object and may accept additional positional and
keyword arguments which will be set by unpacking input arguments using
`*args` and `**kwargs` calling conventions. The factory function should
return a new object that will replace the original object.
)r    r$   )	r   r   factoryargskwargsr   r   r   wrappers	            r   wrap_objectr+   G   s6     %1$>!Vh000G7+Nr   c                   ,    \ rS rSrS rS rS rS rSrg)AttributeWrapperc   c                 4    Xl         X l        X0l        X@l        g r	   )r   r'   r(   r)   )selfr   r'   r(   r)   s        r   __init__AttributeWrapper.__init__e   s    "	r   c                     UR                   U R                     nU R                  " U/U R                  Q70 U R                  D6$ r	   )__dict__r   r'   r(   r)   )r0   instanceownervalues       r   __get__AttributeWrapper.__get__k   s7    !!$..1||E=DII===r   c                 4    X!R                   U R                  '   g r	   r4   r   )r0   r5   r7   s      r   __set__AttributeWrapper.__set__o   s    ,1$..)r   c                 2    UR                   U R                  	 g r	   r;   )r0   r5   s     r   
__delete__AttributeWrapper.__delete__r   s    dnn-r   )r(   r   r'   r)   N)	__name__
__module____qualname____firstlineno__r1   r8   r<   r?   __static_attributes__r%   r   r   r-   r-   c   s    >2.r   r-   c                 z    UR                  SS5      u  pV[        X5      S   n[        XbX45      n[        XvU5        U$ )aH  
Wraps an object which is the attribute of a class instance with a wrapper
object created by the `factory` function. It does this by patching the
class, not the instance, with a descriptor that intercepts access to the
instance attribute. The `module` can be a module, class, or instance of a
class. In the special case of `module` being a string, it is assumed to be
the name of a module, with the module being imported if necessary and then
used as the target object. The `name` is a string representing the dotted
path to the attribute. The `factory` function should accept the original
object and may accept additional positional and keyword arguments which will
be set by unpacking input arguments using `*args` and `**kwargs` calling
conventions. The factory function should return a new object that will
replace the original object.
r   r      )rsplitr    r-   r$   )	moduler   r'   r(   r)   r   r   r   r*   s	            r   wrap_object_attributerJ   v   s@      kk#q)OD&'*Fy4@G7+Nr   c                 (   ^  U 4S jn[        T U5      $ )a  
Creates a decorator for wrapping a function with a `wrapper` function.
The decorator which is returned may also be applied to any other callable
objects such as lambda functions, methods, classmethods, and staticmethods,
or objects which implement the `__call__()` method. The `wrapper` function
should accept the `wrapped` function, `instance`, `args`, and `kwargs`,
arguments and return the result of calling the wrapped function or some
other appropriate value.
c                    > US   nUc  TnOI[         R                  " U5      (       a  TR                  S U5      nOTR                  U[        U5      5      n[	        XE5      $ )Nr   r
   r   r8   typer   )wrappedr5   r(   r)   target_wrappedtarget_wrapperr*   s         r   _wrapper"function_wrapper.<locals>._wrapper   sU    a$N__X&&$__T8<N$__XtH~FN~>>r   r   )r*   rR   s   ` r   function_wrapperrT      s    ? 7H--r   c                 &    [        X[        U45      $ )a(  
Wraps a function which is the attribute of a target object with a `wrapper`
function. The `target` can be a module, class, or instance of a class. In
the special case of `target` being a string, it is assumed to be the name
of a module, with the module being imported if necessary. The `name` is a
string representing the dotted path to the attribute. The `wrapper` function
should accept the `wrapped` function, `instance`, `args`, and `kwargs`
arguments, and would return the result of calling the wrapped attribute or
some other appropriate value.
r+   r   )r   r   r*   s      r   wrap_function_wrapperrW      s     v_wjAAr   c                    ^ ^^ UUU 4S jnU$ )a  
Creates a decorator which can be applied to a wrapper function, where the
wrapper function will be used to wrap a function which is the attribute of
a target object. The `target` can be a module, class, or instance of a class.
In the special case of `target` being a string, it is assumed to be the name
of a module, with the module being imported if necessary. The `name` is a
string representing the dotted path to the attribute. The `enabled`
argument can be a boolean or a callable that returns a boolean. When a
callable is provided, it will be called each time the wrapper is invoked to
determine if the wrapper function should be executed or whether the wrapped
function should be called directly. If `enabled` is not provided, the
wrapper is enabled by default.
c                 ,   > [        TT[        U T45      $ r	   rV   )r*   enabledr   r   s    r   rR   (patch_function_wrapper.<locals>._wrapper   s    647G:LMMr   r%   )r   r   rZ   rR   s   ``` r   patch_function_wrapperr\      s    N Or   c                    ^ ^ UU 4S jnU$ )a  Creates a decorator that patches a target function with a wrapper
function, but only for the duration of the call that the decorator was
applied to. The `target` can be a module, class, or instance of a class.
In the special case of `target` being a string, it is assumed to be the name
of a module, with the module being imported if necessary. The `name` is a
string representing the dotted path to the attribute.
c                 .   >^  UUU 4S jn[        T U5      $ )Nc                    >^ US   nUc  T	mOI[         R                  " U5      (       a  T	R                  S U5      mOT	R                  U[        U5      5      mUUU4S jn[	        XE5      $ )Nr   c                    > [        T	T5      u  pEn[        UT
5      n[        XEU5         U " U0 UD6[        XEU5        $ ! [        XEU5        f = fr	   )r    r   r"   )rO   r5   r(   r)   r   r   r   r#   r   r   rQ   s           r   _executeRtransient_function_wrapper.<locals>._decorator.<locals>._wrapper.<locals>._execute   sQ    0<VT0J-H-hG;79"D3F3Fx8GFx8s	   > ArM   )
rO   r5   r(   r)   rP   ra   rQ   r   r   r*   s
         @r   rR   @transient_function_wrapper.<locals>._decorator.<locals>._wrapper   s\    !!WN!(**!(x!@!(4>!J9 #><<r   r   )r*   rR   r   r   s   ` r   
_decorator.transient_function_wrapper.<locals>._decorator   s    	=( w11r   r%   )r   r   rd   s   `` r   transient_function_wrapperrf      s    2. r   r	   )r
   r   	__wrapt__r   r    r$   r+   r-   rJ   rT   rW   r\   rf   r%   r   r   <module>rh      sP     
 &
1)h, -/r 8. .& 79 :.0B* r   