§
    ¼Ë”j‘  ã                   ó\  — d Z ddlZddlZddlZddlZddlZddlmZmZ ddl	m
Z
mZmZmZmZ ddlmZ  G d„ d¦  «        Z e¦   «         Zd	„ Zd
„ Zd„ Zd!d„Z G d„ de¦  «        Zd!d„Zd„ Zd„ Zefedœd„Zd„ Zej        d„ ¦   «         Zddœd„Zddœd„Z d"dddœd„Z!d"dddœd„Z"ddœd „Z#dS )#z=Utilities for monkey patching and wrapping object attributes.é    Né   )ÚBaseObjectProxyÚFunctionWrapper)ÚPathResolutionErrorÚTargetModuleNotFoundErrorÚWrapperChainTooDeepErrorÚWrapperNotFoundErrorÚWrapperNotOutermostError)Úregister_post_import_hookc                   ó2   ‡ — e Zd ZdZdZˆ fd„Zd„ Zd„ Zˆ xZS )Ú_MissingTypez�The type of the MISSING sentinel, which marks the absence of a value
    or attribute definition where None is itself meaningful.Nc                 ól   •— | j         €&t          ¦   «                              | ¦  «        | _         | j         S ©N)Ú	_instanceÚsuperÚ__new__)ÚclsÚ	__class__s    €ú;C:\Projects\DSCons\.venv\Lib\site-packages\wrapt/patches.pyr   z_MissingType.__new__    s*   ø€ ØŒ=Ð Ý!™GœGŸOšO¨CÑ0Ô0ˆCŒMØŒ}Ðó    c                 ó   — dS )Nz<wrapt.MISSING>© ©Úselfs    r   Ú__repr__z_MissingType.__repr__%   s   € Ø Ð r   c                 ó   — t           dfS )Nr   )r   r   s    r   Ú
__reduce__z_MissingType.__reduce__(   s   € õ ˜bÐ!Ð!r   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   Ú__classcell__©r   s   @r   r   r      si   ø€ € € € € ð@ð @ð €Iðð ð ð ð ð
!ð !ð !ð"ð "ð "ð "ð "ð "ð "r   r   c                 óN  ‡ ‡— t          ‰ t          ¦  «        r>	 t          j        ‰ ¦  «        Š n(# t          $ r}t          d‰ ›d‰›�¦  «        |‚d}~ww xY w‰ }‰                     d¦  «        }|d         }ˆˆ fd„} |||¦  «        }|dd…         D ]}|} |||¦  «        }Œ|||fS )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. If the module cannot be imported, raises
    `TargetModuleNotFoundError`, and if the attribute path cannot be resolved,
    raises `PathResolutionError`, in both cases with the original exception
    preserved as the `__cause__` attribute.
    zunable to import module z  while resolving the target for Nú.r   c           	      óB  •— 	 t          j        | ¦  «        rOt          j        | ¦  «        D ]*}|t          |¦  «        v rt          |¦  «        |         c S Œ+t	          | |¦  «        S t	          | |¦  «        S # t
          $ r}t          d|›d‰›d‰›�¦  «        |‚d }~ww xY w)Nzunable to resolve attribute z	 in path z on )ÚinspectÚisclassÚgetmroÚvarsÚgetattrÚAttributeErrorr   )ÚparentÚ	attributer   ÚexcÚnameÚtargets       €€r   Úlookup_attributez&resolve_path.<locals>.lookup_attributeb   sã   ø€ ð	ÝŒ˜vÑ&Ô&ð 2Ý"œ>¨&Ñ1Ô1ð 6ð 6�CØ ¥D¨¡I¤IÐ-Ð-Ý# C™yœy¨Ô3Ð3Ð3Ð3ð .õ # 6¨9Ñ5Ô5Ð5å˜v yÑ1Ô1Ð1øÝð 	ð 	ð 	Ý%ð*¨yð *ð *Øð*ð *Ø%ð*ð *ñô ð ðøøøøð	øøøs$   ƒAA6 ÁA6 Á&A6 Á6
BÂ BÂBr   )Ú
isinstanceÚstrÚ	importlibÚimport_moduleÚModuleNotFoundErrorr   Úsplit)r1   r0   r/   r-   Úpathr.   r2   Úoriginals   ``      r   Úresolve_pathr;   3   s  øø€ õ �&�#ÑÔð ð	ÝÔ,¨VÑ4Ô4ˆFˆFøÝ"ð 	ð 	ð 	Ý+ð+¨6ð +ð +Ø"&ð+ð +ñô ð ðøøøøð	øøøð €Fà�:Š:�c‰?Œ?€DØ�Q”€Iðð ð ð ð ð ð   Ð ¨	Ñ2Ô2€Hà˜!˜"˜"”Xð 7ð 7ˆ	ØˆØ#Ð# F¨IÑ6Ô6ˆˆà�I˜xÐ(Ð(s   ™. ®
A¸AÁAc                 ó˜  — t          | |¦  «        \  }}}t          j        |¦  «        rt          j        |¦  «        }nJt          j        |¦  «        r|f}n2|ft          t          j        t          |¦  «        ¦  «        ¦  «        z   }|D ]+}	 |t          |¦  «        v r|||fc S Œ# t          $ r Y Œ(w xY wt          d|›d|›d�¦  «        ‚)a·  
    Sibling of the `resolve_path()` function, resolving the dotted path
    supplied as `name` on a target object in the same way and returning a
    tuple of the same shape, with one difference: the first element is the
    object whose `__dict__` actually defines the attribute, rather than
    the object the path resolved to. The two answer different questions.
    `resolve_path()` answers where to write so that lookups through the
    named object are affected, which is the correct location for
    installing a wrapper, and shadowing an inherited definition is
    legitimate there. `resolve_owner()` answers where the attribute
    physically lives, which is the correct location for removing a
    wrapper, since restoring anywhere other than the defining location
    would leave a shadowing copy behind. For a class target the owner is
    the defining class found by walking the MRO, for an instance target
    it is the instance itself if the attribute is in its `__dict__` and
    otherwise the defining class, and for a module target it is the
    module. For dotted paths the owner logic applies to the final segment
    only. An attribute served dynamically, such as by a module level or
    metaclass `__getattr__`, exists in no `__dict__`, and rather than
    guess, `PathResolutionError` is raised, where `resolve_path()` would
    return the value happily. Failures resolving the path itself raise
    exactly as for `resolve_path()`.
    z
attribute z of zb is not defined in any __dict__; it is served dynamically, so there is no owning location to patch)
r;   r'   r(   r)   ÚismoduleÚtupleÚtyper*   Ú	TypeErrorr   )r1   r0   r-   r.   r:   Ú
candidatesÚ	candidates          r   Úresolve_ownerrC   {   s  € õ2 #/¨v°tÑ"<Ô"<Ñ€FˆI�xå„�vÑÔð EÝ”^ FÑ+Ô+ˆ
ˆ
Ý	Ô	˜&Ñ	!Ô	!ð EØ�Yˆ
ˆ
à�Y¥¥w¤~µd¸6±l´lÑ'CÔ'CÑ!DÔ!DÑDˆ
àð ð ˆ	ð	Ø�D ™OœOÐ+Ð+Ø! 9¨hÐ7Ð7Ð7Ð7ð ,øåð 	ð 	ð 	ØˆHð	øøøõ ð	�Yð 	ð 	 fð 	ð 	ð 	ñô ð s   ÂB&Â&
B3Â2B3c                 ó(   — t          | ||¦  «         dS )zv
    Convenience function for applying a patch to an attribute. This maps to
    the standard setattr() function.
    N)Úsetattr)r-   r.   Úreplacements      r   Úapply_patchrG   «   s   € õ ˆF�I˜{Ñ+Ô+Ð+Ð+Ð+r   r   c                 ó
  — |€i }t          | |¦  «        \  }}}	 |t          |¦  «        v}n# t          $ r d}Y nw xY w ||g|¢R i |¤Ž}		 |	                     d|¦  «         n# t          $ r Y nw xY wt          |||	¦  «         |	S )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, and should
    ordinarily be a `BaseObjectProxy` subclass or return an instance of
    one, so that the replacement can carry the installation details which
    `unwrap_object()` later relies upon to restore things faithfully.
    NFÚ"__wrapt_wrap_object_created_slot__)r;   r*   r@   Ú__self_setattr__r,   rG   )
r1   r0   ÚfactoryÚargsÚkwargsr-   r.   r:   ÚcreatedÚwrappers
             r   Úwrap_objectrP   ´   sØ   € ð" €~Øˆå".¨v°tÑ"<Ô"<Ñ€FˆI�xðØ¥4¨¡<¤<Ð/ˆˆøÝð ð ð Øˆˆˆðøøøð ˆg�hÐ0 Ð0Ð0Ð0¨Ð0Ð0€GðØ× Ò Ð!EÀwÑOÔOÐOÐOøÝð ð ð Øˆðøøøõ �˜	 7Ñ+Ô+Ð+à€Ns   š, ¬;º;ÁA" Á"
A/Á.A/c                   ó8   ‡ — e Zd ZdZdˆ fd„	Zd	d„Zd„ Zd„ Zˆ xZS )
ÚAttributeWrapperam  A descriptor that intercepts access to an instance attribute to apply
    a wrapper factory. The descriptor is an object proxy whose wrapped object
    is whatever previously occupied the class attribute, or the MISSING
    sentinel when nothing did, so stacked applications compose and a prior
    descriptor keeps executing its own logic beneath the interception.r   Nc                 ó˜   •— t          t          | ¦  «                             |¦  «         || _        || _        || _        |�|ni | _        d S r   )r   rR   Ú__init__Ú_self_attributeÚ_self_factoryÚ
_self_argsÚ_self_kwargs)r   Úwrappedr.   rK   rL   rM   r   s         €r   rT   zAttributeWrapper.__init__ú   sP   ø€ ÝÕ Ñ%Ô%×.Ò.¨wÑ7Ô7Ð7Ø(ˆÔØ$ˆÔØˆŒØ&,Ð&8˜F˜F¸bˆÔÐÐr   c                 óø  — |€| S | j         }t          |¦  «        }t          |d¦  «        r7t          |d¦  «        st          |d¦  «        r|                     ||¦  «        }n| j        |j        v r|j        | j                 }n^t          |d¦  «        r|                     ||¦  «        }n7|t          ur|}n+t          t          |¦  «        j        ›d| j        ›�¦  «        ‚ | j	        |g| j
        ¢R i | j        ¤ŽS )NÚ__get__Ú__set__Ú
__delete__ú object has no attribute )Ú__wrapped__r?   Úhasattrr[   rU   Ú__dict__ÚMISSINGr,   r   rV   rW   rX   )r   ÚinstanceÚownerÚpriorÚ
prior_typeÚvalues         r   r[   zAttributeWrapper.__get__  s/  € ð
 ÐØˆKð Ô ˆÝ˜%‘[”[ˆ
å�:˜yÑ)Ô)ð 	Ý�J 	Ñ*Ô*ð	Ý.5°jÀ,Ñ.OÔ.Oð	ð —M’M (¨EÑ2Ô2ˆEˆEØÔ! XÔ%6Ð6Ð6ØÔ% dÔ&:Ô;ˆEˆEÝ�Z Ñ+Ô+ð 	Ø—M’M (¨EÑ2Ô2ˆEˆEØ�'Ð!Ð!ØˆEˆEå Ý˜‘>”>Ô*ð ,ð ,ØÔ'ð,ð ,ñô ð ð
 "ˆtÔ! %ÐO¨$¬/ÐOÐOÐO¸TÔ=NÐOÐOÐOr   c                 óœ   — | j         }t          t          |¦  «        d¦  «        r|                     ||¦  «         d S ||j        | j        <   d S )Nr\   )r_   r`   r?   r\   ra   rU   )r   rc   rg   re   s       r   r\   zAttributeWrapper.__set__%  sT   € ð
 Ô ˆå•4˜‘;”; 	Ñ*Ô*ð 	<Ø�MŠM˜( EÑ*Ô*Ð*Ð*Ð*à6;ˆHÔ˜dÔ2Ñ3Ð3Ð3r   c                 ó  — | j         }t          t          |¦  «        d¦  «        r|                     |¦  «         d S 	 |j        | j        = d S # t          $ r- t          t          |¦  «        j        ›d| j        ›�¦  «        d ‚w xY w)Nr]   r^   )	r_   r`   r?   r]   ra   rU   ÚKeyErrorr,   r   )r   rc   re   s      r   r]   zAttributeWrapper.__delete__1  s­   € ØÔ ˆå•4˜‘;”; Ñ-Ô-ð 	Ø×Ò˜XÑ&Ô&Ð&Ð&Ð&ðØÔ% dÔ&:Ð;Ð;Ð;øÝð ð ð Ý$Ý˜H‘~”~Ô.ð 0ð 0ØÔ+ð0ð 0ñô ð ððøøøs   ½A Á7B©r   Nr   )	r   r   r    r!   rT   r[   r\   r]   r"   r#   s   @r   rR   rR   ó   s†   ø€ € € € € ðJð JðAð Að Að Að Að Að"Pð "Pð "Pð "PðH
<ð 
<ð 
<ðð ð ð ð ð ð r   rR   c                 ó  — |€i }|                      dd¦  «        \  }}t          | |¦  «        d         }t          |¦  «                             |t          ¦  «        }t          |||||¦  «        }	t          |||	¦  «         |	S )av  
    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. Returns the `AttributeWrapper` descriptor
    installed on the class, which wraps whatever previously occupied the
    class attribute, or the `MISSING` sentinel when nothing did, so repeated
    applications compose rather than replace one another.
    Nr%   r   é   )Úrsplitr;   r*   Úgetrb   rR   rG   )
Úmoduler0   rK   rL   rM   r9   r.   r-   re   rO   s
             r   Úwrap_object_attributerq   D  s€   € ð& €~Øˆà—k’k # qÑ)Ô)�O€Dˆ)Ý˜& $Ñ'Ô'¨Ô*€FÝ�‰LŒL×Ò˜Y­Ñ0Ô0€EÝ˜u i°¸$ÀÑGÔG€GÝ�˜	 7Ñ+Ô+Ð+Ø€Nr   c                 ó.   ‡ — ˆ fd„}t          ‰ |¦  «        S )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                 óÚ   •— |d         }|€‰}nNt          j        |¦  «        r‰                     d |¦  «        }n#‰                     |t          |¦  «        ¦  «        }t	          ||¦  «        S )Nr   ©r'   r(   r[   r?   r   )rY   rc   rL   rM   Útarget_wrappedÚtarget_wrapperrO   s         €r   Ú_wrapperz"function_wrapper.<locals>._wrappers  sj   ø€ Ø˜aœˆØÐØ$ˆNˆNÝŒ_˜XÑ&Ô&ð 	GØ$Ÿ_š_¨T°8Ñ<Ô<ˆNˆNà$Ÿ_š_¨Xµt¸H±~´~ÑFÔFˆNÝ˜~¨~Ñ>Ô>Ð>r   ©r   )rO   rw   s   ` r   Úfunction_wrapperry   h  s.   ø€ ð?ð ?ð ?ð ?ð ?õ ˜7 HÑ-Ô-Ð-r   c                 ó:  ‡‡— t          | t          ¦  «        rm|                      d¦  «        rX| dd…         } | t          j        v r(t          t          j        |          ‰t          ‰f¦  «        S ˆˆfd„}t          || ¦  «         dS t          | ‰t          ‰f¦  «        S )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. If the `target`
    is a string with a trailing ``?``, the wrapping will be deferred until the
    module is imported. If the module is already imported, the wrapping will be
    applied immediately. 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. Returns the
    wrapped target function if the wrapping was applied immediately, or ``None``
    if the wrapping was deferred.
    ú?Néÿÿÿÿc                 ó8   •— t          | ‰t          ‰f¦  «         d S r   ©rP   r   )rp   r0   rO   s    €€r   Úcallbackz'wrap_function_wrapper.<locals>.callback–  s   ø€ Ý˜ ¥o¸°zÑBÔBÐBÐBÐBr   ©r3   r4   ÚendswithÚsysÚmodulesrP   r   r   )r1   r0   rO   r   s    `` r   Úwrap_function_wrapperr„   €  s³   øø€ õ  �&�#ÑÔð 
 6§?¢?°3Ñ#7Ô#7ð 
Ø˜˜˜”ˆà•S”[Ð Ð Ý�sœ{¨6Ô2°D½/ÈGÈ:ÑVÔVÐVð	Cð 	Cð 	Cð 	Cð 	Cð 	Cõ 	" (¨FÑ3Ô3Ð3Øˆtå�v˜t¥_°w°jÑAÔAÐAr   )Úenabledc                ó®   ‡ ‡‡— |t           ur6‰t           urt          d¦  «        ‚t          j        dt          d¬¦  «         |Š‰t           u rdŠˆˆˆ fd„}|S )at  
    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 decorator returns the original 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. If the `target` is a string with a
    trailing ``?``, the wrapping will be deferred until the module is imported.
    If the module is already imported, the wrapping will be applied immediately.
    The `name` is a string representing the dotted path to the attribute. The
    `enabled` argument is keyword only and 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, or an explicit value of `None` is supplied,
    the wrapper is enabled by default.
    zCpatch_function_wrapper() got multiple values for argument 'enabled'zšPassing 'enabled' positionally to patch_function_wrapper() is deprecated and will be an error in a future version of wrapt; pass it as a keyword argument.rm   )Ú
stacklevelNc                 óH  •‡ — t          ‰t          ¦  «        rq‰                     d¦  «        r\‰d d…         }|t          j        v r+t          t          j        |         ‰t          ‰ ‰f¦  «         ‰ S ˆˆˆ fd„}t          ||¦  «         ‰ S t          ‰‰t          ‰ ‰f¦  «         ‰ S )Nr{   r|   c                 ó:   •— t          | ‰t          ‰‰f¦  «         d S r   r~   )rp   r…   r0   rO   s    €€€r   r   z:patch_function_wrapper.<locals>._wrapper.<locals>.callbackÍ  s"   ø€ Ý˜F D­/¸GÀWÐ;MÑNÔNÐNÐNÐNr   r€   )rO   Ú_targetr   r…   r0   r1   s   `  €€€r   rw   z(patch_function_wrapper.<locals>._wrapperÃ  sÐ   øø€ Ý�f�cÑ"Ô"ð 	 v§¢°sÑ';Ô';ð 	Ø˜S˜b˜S”kˆGà�#œ+Ð%Ð%ÝÝ”K Ô(¨$µÀ'È7ÐASñô ð ð �ðOð Oð Oð Oð Oð Oð Oõ & h°Ñ8Ô8Ð8ØˆNå�F˜D¥/°G¸WÐ3EÑFÔFÐFØˆr   )rb   r@   ÚwarningsÚwarnÚDeprecationWarning)r1   r0   Ú_enabledr…   rw   s   `` ` r   Úpatch_function_wrapperr�   Ÿ  s›   øøø€ ð& •wÐÐØ�'Ð!Ð!ÝØXñô ð õ 	Œð-õ Øð	
ñ 	
ô 	
ð 	
ð ˆà•'ÐÐØˆðð ð ð ð ð ð ð& €Or   c                 ó   ‡ ‡— ˆˆ fd„}|S )aQ  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. The patch is applied
    to the object the path resolves to, so patching an attribute reached
    through inheritance, or through an instance, only affects lookups made
    through that object and not the class where the attribute is defined. In
    that case the temporary attribute which shadowed the inherited definition
    is removed again when the call exits, restoring the original lookup.

    The temporary wrapper is removed using `unwrap_object()`, so if code
    called within the scope of the patch wrapped over the top of the
    temporary wrapper with a wrapt wrapper and left it there, the temporary
    wrapper is spliced out beneath it, with the other wrapper left in
    place. If something removed or replaced the temporary wrapper during
    the call, `WrapperNotFoundError` is raised, and if what was applied on
    top of it is not a wrapt wrapper and so cannot be spliced past,
    `WrapperNotOutermostError` is raised. Both are loud deliberately, as
    they indicate the surrounding code, typically a test harness, is not
    managing its own patches properly, and the leaked patch state would
    otherwise surface as hard to diagnose failures later.
    c                 ó4   •‡ — ˆˆˆ fd„}t          ‰ |¦  «        S )Nc                 óê   •‡— |d         }|€‰	ŠnNt          j        |¦  «        r‰	                     d |¦  «        Šn#‰	                     |t          |¦  «        ¦  «        Šˆˆˆfd„}t	          ||¦  «        S )Nr   c                 ó”   •— t          ‰‰t          ‰f¦  «        }	  | |i |¤Žt          ‰‰|¦  «         S # t          ‰‰|¦  «         w xY wr   )rP   r   Úunwrap_object)rY   rc   rL   rM   rF   r0   r1   rv   s        €€€r   Ú_executezRtransient_function_wrapper.<locals>._decorator.<locals>._wrapper.<locals>._executeý  sd   ø€ õ *Ø˜D¥/°NÐ3Dñô �ð=Ø"˜7 DÐ3¨FÐ3Ð3å! &¨$°Ñ<Ô<Ð<Ð<ø•M &¨$°Ñ<Ô<Ð<Ð<øøøs	   ›4 ´Art   )
rY   rc   rL   rM   ru   r•   rv   r0   r1   rO   s
         @€€€r   rw   z@transient_function_wrapper.<locals>._decorator.<locals>._wrapperô  s�   øø€ Ø! !œWˆNØÐØ!(��Ý” Ñ*Ô*ð KØ!(§¢°°xÑ!@Ô!@��à!(§¢°½4À¹>¼>Ñ!JÔ!J�ð=ð =ð =ð =ð =ð =ð =õ, # >°8Ñ<Ô<Ð<r   rx   )rO   rw   r0   r1   s   ` €€r   Ú
_decoratorz.transient_function_wrapper.<locals>._decoratoró  s:   øø€ ð	=ð 	=ð 	=ð 	=ð 	=ð 	=ð 	=õB ˜w¨Ñ1Ô1Ð1r   r   )r1   r0   r–   s   `` r   Útransient_function_wrapperr—   Ù  s+   øø€ ð4"2ð "2ð "2ð "2ð "2ð "2ðH Ðr   c              #   óö   K  — t          | t          ¦  «        r$|                      d¦  «        rt          d¦  «        ‚t	          | ||¦  «        }	 dV — t          | ||¦  «         dS # t          | ||¦  «         w xY w)a  Returns a context manager which patches a target function with a
    wrapper function for the duration of a with statement, the block scoped
    counterpart of the `transient_function_wrapper()` decorator. The
    arguments take the same form as for `wrap_function_wrapper()`: the
    `target` can be a module, class, or instance of a class, or the name of
    a module as a string, the `name` is a string representing the dotted
    path to the attribute, and the `wrapper` function should accept the
    `wrapped`, `instance`, `args`, and `kwargs` arguments. The deferred
    form of the `target` with a trailing ``?`` is not supported, since the
    patch must be applied at the point the with statement is entered. The
    context manager yields nothing, is single use, and removes the wrapper
    using `unwrap_object()` when the block exits, with the same behaviour
    as `transient_function_wrapper()` when something interfered with the
    patch during the block: a wrapt wrapper applied on top of the temporary
    wrapper and left there is tolerated, with the temporary wrapper spliced
    out beneath it, while the temporary wrapper having been removed or
    replaced raises `WrapperNotFoundError`, and a non wrapt wrapper left
    applied on top raises `WrapperNotOutermostError`.
    r{   zbdeferred wrapping using a target with a trailing '?' cannot be used with scoped_function_wrapper()N)r3   r4   r�   Ú
ValueErrorr„   r”   )r1   r0   rO   Úhandles       r   Úscoped_function_wrapperr›     s•   è è € õ, �&�#ÑÔð 
 6§?¢?°3Ñ#7Ô#7ð 
Ýð5ñ
ô 
ð 	
õ
 # 6¨4°Ñ9Ô9€Fð,Øˆˆˆå�f˜d FÑ+Ô+Ð+Ð+Ð+ø��f˜d FÑ+Ô+Ð+Ð+øøøs   ÁA% Á%A8é@   ©Úlimitc             #   óP  K  — g }t          ¦   «         }| }	 t          |¦  «        |v rdS t          |¦  «        |k    rt          d| ›d|› d�¦  «        ‚|                     |¦  «         |                     t          |¦  «        ¦  «         |V — 	 |j        }n# t          $ r Y dS w xY wŒ’)aa  
    Returns an iterator yielding `obj`, then each successive object found
    by following the `__wrapped__` attribute, outermost wrapper first. The
    final item yielded is the innermost object of the chain, which is not
    itself a wrapper. Traversal ends cleanly at an object with no
    `__wrapped__` attribute, or upon returning to an object already seen.
    If the `limit` on the number of items yielded is reached with a further
    chain link still pending, `WrapperChainTooDeepError` is raised, as a
    truncated scan would otherwise be indistinguishable from a complete
    one. A chain of exactly `limit` items which ends naturally is not an
    error. Note that reading `__wrapped__` from a lazy object proxy will
    cause it to materialize, and an exception raised by a broken proxy or
    a lazy object factory will propagate to the caller.
    TNzwrapper chain of z
 exceeded z levels)ÚsetÚidÚlenr   ÚappendÚaddr_   r,   )Úobjrž   ÚseenÚseen_idsÚcurrents        r   Úwrapper_chainr©   D  sÚ   è è € ð. €DÝ‰uŒu€Hà€GðÝˆg‰;Œ;˜(Ð"Ð"ØˆFåˆt‰9Œ9˜ÒÐÝ*ØC CÐCÐC°UÐCÐCÐCñô ð ð 	�Š�GÑÔÐØ�Š•R˜‘[”[Ñ!Ô!Ð!àˆˆˆð	ØÔ)ˆGˆGøÝð 	ð 	ð 	ØˆFˆFð	øøøð!s   ÂB Â
B$Â#B$c                ó2   — | }t          | |¬¦  «        D ]}Œ|S )a|  
    Returns the innermost object of the chain of wrappers followed from
    `obj` by the `wrapper_chain()` function, or `obj` itself when it is not
    wrapped. Shares the full contract of `wrapper_chain()`, including
    raising `WrapperChainTooDeepError` when the scan is indeterminate,
    rather than returning a mid chain wrapper as if it were the innermost
    object.
    r�   )r©   )r¥   rž   Úresults      r   Ú	unwrappedr¬   t  s-   € ð €Få ¨5Ð1Ñ1Ô1ð ð ˆØà€Mr   ©Ú	predicaterž   c                ó„   — |€|€t          d¦  «        ‚t          | |¬¦  «        D ]}|�||urŒ	|� ||¦  «        sŒ|c S dS )a-  
    Scans the chain of wrappers followed from `obj` by the
    `wrapper_chain()` function for a specific wrapper and returns it, or
    `None` when it is not present. The `handle` argument is the wrapper
    object to look for, as returned by the wrap functions when the wrapper
    was installed, and is matched by object identity only, never equality,
    which proxies delegate to the wrapped object. Alternatively a
    `predicate` function may be supplied, in which case the first chain
    entry for which it returns true is returned, and is itself usable as a
    handle thereafter. When both are supplied, both must match. At least
    one of the two must be supplied, since testing for the mere presence
    of any wrapper is fragile: were the target library to adopt wrapt for
    its own purposes, such a test would wrongly conclude a wrapper of
    yours was installed. Shares the full contract of `wrapper_chain()`,
    including raising `WrapperChainTooDeepError` when the scan is
    indeterminate, rather than returning `None` as a false negative.
    Nz7find_wrapper() requires a wrapper handle or a predicater�   )r@   r©   )r¥   rš   r®   rž   Úentrys        r   Úfind_wrapperr±   †  sz   € ð& €~˜)Ð+ÝØEñ
ô 
ð 	
õ ˜s¨%Ð0Ñ0Ô0ð ð ˆØÐ %¨vÐ"5Ð"5ØØÐ ¨¨°5Ñ)9Ô)9Ð ØØˆˆˆàˆ4r   c                ó,   — t          | |||¬¦  «        duS )a%  
    Boolean convenience form of the `find_wrapper()` function, returning
    whether the wrapper is present in the chain of wrappers followed from
    `obj`. With a `handle`, this answers whether the wrapper it was
    returned for when installed is still in place, which is the check to
    run when a third party may have replaced the attribute wholesale.
    Shares the full contract of `find_wrapper()`, including raising
    `WrapperChainTooDeepError` when the scan is indeterminate, rather
    than returning `False` as a false negative.
    r­   N)r±   )r¥   rš   r®   rž   s       r   Úis_wrapped_byr³   ¨  s    € õ ˜˜V¨yÀÐFÑFÔFÈdÐRÐRr   F)Ú
missing_okc          
      óD  ‡‡— 	 t          | |¦  «        \  }Š}n›# t          $ rŽ}	 t          | |¦  «        d         }n# t          $ r d}Y nw xY w|�<t          ||¦  «        �,t	          dt          |¦  «        j        › d| ›d|› d�¦  «        |‚|rY d}~dS t          d|›d| ›d|› �¦  «        |‚d}~ww xY wt          ||¦  «        Š‰�	 ‰j        }n# t          $ r dŠY nw xY w‰€|rdS t          d|›d| ›d|› �¦  «        ‚‰|ur»t          t          |¦  «        ¦  «        }t          ˆfd	„t          |¦  «        D ¦   «         ¦  «        }	||	d
z
           }
t          t          |
¦  «        t          ¦  «        sAd„ |d|	…         D ¦   «         }t	          dt          ‰¦  «        j        › d| ›d|› d|› �¦  «        ‚||
_        ‰S |t           u rt#          |‰¦  «         ‰S 	 ‰j                             d¦  «        }n# t          $ r d}Y nw xY w|�&|rt#          |‰¦  «         nt)          |‰|¦  «         ‰S t+          j        |¦  «        rLt          ˆfd„t+          j        |¦  «        d
d…         D ¦   «         d¦  «        }||u rt#          |‰¦  «         ‰S t)          |‰|¦  «         ‰S )aÊ  
    Removes a wrapper which was installed on an attribute of a target
    object, the inverse of the `wrap_object()` function and the removal
    call for every wrap form, `wrap_function_wrapper()` and
    `wrap_object_attribute()` included. The `target` and `name` arguments
    take the same form as for `resolve_path()`. The `handle` argument is
    the wrapper object which was returned when the wrapper was installed,
    and is matched by object identity only. Note that it is not the
    wrapper function: passing the wrapper function surfaces immediately
    as `WrapperNotFoundError`, since a function is never a chain entry.

    When the wrapper is found and is outermost, the attribute is restored
    to the object the wrapper wrapped, at the location where the attribute
    is actually defined per `resolve_owner()`, so removal through a
    subclass restores the defining base class rather than leaving a
    shadowing copy. If restoring would merely shadow the identical object
    already reachable through the MRO, or the wrapper was installed where
    no prior definition existed (a `MISSING` terminal), the attribute is
    instead removed so no residue is left behind. When the wrapper is
    found buried beneath other wrapt wrappers, it is spliced out of the
    chain in place, without touching the attribute or disturbing the
    wrappers above it. When what sits directly above it is not a wrapt
    wrapper, such as a plain `functools.wraps()` closure whose
    `__wrapped__` is only metadata, `WrapperNotOutermostError` is raised
    naming what is above, since splicing there would silently not take
    effect.

    When the wrapper is not found, because the attribute was never
    wrapped, the wrapper was already removed, or a third party replaced
    the attribute wholesale, `WrapperNotFoundError` is raised by default.
    Passing `missing_ok=True` returns `None` instead, for shutdown paths
    which must tolerate third party interference. In either case nothing
    is mutated. The wrapper which was removed is returned. Note that
    `missing_ok` does not suppress `WrapperChainTooDeepError` from the
    underlying scan, since an indeterminate scan is not the same thing as
    the wrapper being gone.
    rm   Nzcannot remove z from r%   zK: the attribute is served dynamically and has no owning location to restorezhandle z not found on c              3   ó*   •K  — | ]\  }}|‰u ¯	|V — Œd S r   r   )Ú.0Úindexr°   Úfounds      €r   ú	<genexpr>z unwrap_object.<locals>.<genexpr>  s4   øè è € ð 
ð 
Ù"�e˜U¸%À5¸.¸.ˆE¸.¸.¸.¸.ð
ð 
r   r   c                 ó6   — g | ]}t          |¦  «        j        ‘ŒS r   )r?   r   )r·   r°   s     r   ú
<listcomp>z!unwrap_object.<locals>.<listcomp>  s!   € ÐHÐHÐH¨e•T˜%‘[”[Ô)ÐHÐHÐHr   z: wrapped by rI   c              3   ód   •K  — | ]*}‰t          |¦  «        v ¯t          |¦  «        ‰         V — Œ+d S r   )r*   )r·   r   r.   s     €r   rº   z unwrap_object.<locals>.<genexpr>G  sK   øè è € ð ð àØ¥ S¡	¤	Ð)Ð)õ �S‘	”	˜)Ô$à)Ð)Ð)Ð)ðð r   )rC   r   r;   r±   r
   r?   r   r	   r_   r,   Úlistr©   ÚnextÚ	enumerateÚ
issubclassr   rb   ÚdelattrÚ__self_dict__ro   rG   r'   r(   r)   )r1   r0   rš   r´   rd   r¨   r/   ÚrestoredÚchainÚpositionÚ	neighbourÚaboverN   Ú	inheritedr.   r¹   s                 @@r   r”   r”   ·  sú  øø€ ðNÝ$1°&¸$Ñ$?Ô$?Ñ!ˆˆy˜'˜'øÝð ð ð ð	Ý" 6¨4Ñ0Ô0°Ô3ˆGˆGøÝ"ð 	ð 	ð 	ØˆGˆGˆGð	øøøð Ð¥<°¸Ñ#@Ô#@Ð#LÝ*ð9¥ f¡¤Ô!6ð 9ð 9Øð9ð 9Ø"ð9ð 9ð 9ñô ð ð	ð ð 	Ø�4�4�4�4�4å"Ø?�fÐ?Ð?¨fÐ?Ð?¸Ð?Ð?ñ
ô 
àð	øøøøð-øøøõ4 ˜ &Ñ)Ô)€EàÐð	ØÔ(ˆHˆHøÝð 	ð 	ð 	ð ˆEˆEˆEð		øøøð €}Øð 	Ø�4Ý"Ø?�fÐ?Ð?¨fÐ?Ð?¸Ð?Ð?ñ
ô 
ð 	
ð �GÐÐÝ•] 7Ñ+Ô+Ñ,Ô,ˆõ
 ð 
ð 
ð 
ð 
Ý&/°Ñ&6Ô&6ð
ñ 
ô 
ñ 
ô 
ˆð ˜( Q™,Ô'ˆ	å�$˜y™/œ/­?Ñ;Ô;ð 	ØHÐH°u¸Y¸h¸YÔ7GÐHÑHÔHˆEÝ*ð9¥ e¡¤Ô!5ð 9ð 9Øð9ð 9Ø"ð9ð 9Ø16ð9ð 9ñô ð ð
 !)ˆ	ÔØˆà•7ÐÐå��yÑ!Ô!Ð!ØˆðØÔ%×)Ò)Ð*NÑOÔOˆˆøÝð ð ð Øˆˆˆðøøøð ÐØð 	4õ �E˜9Ñ%Ô%Ð%Ð%å˜˜y¨(Ñ3Ô3Ð3Øˆõ „�uÑÔð Ýðð ð ð å"œ>¨%Ñ0Ô0°°°Ô4ðñ ô ð
 ñ
ô 
ˆ	ð ˜Ð Ð Ý�E˜9Ñ%Ô%Ð%ØˆLå��y (Ñ+Ô+Ð+Ø€LsZ   „ ™
B1¤;ºB,»A
ÁB,Á	A
Á
AB,ÂB,Â,B1ÃC ÃCÃCÇG5 Ç5HÈHrk   r   )$r!   Ú
contextlibr5   r'   r‚   r‹   Ú	__wrapt__r   r   Ú
exceptionsr   r   r   r	   r
   Úimporterr   r   rb   r;   rC   rG   rP   rR   rq   ry   r„   r�   r—   Úcontextmanagerr›   r©   r¬   r±   r³   r”   r   r   r   ú<module>rÏ      s¢  ðØ CÐ Cà Ð Ð Ð Ø Ð Ð Ð Ø €€€Ø 
€
€
€
Ø €€€à 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7ðð ð ð ð ð ð ð ð ð ð ð ð ð ð 0Ð /Ð /Ð /Ð /Ð /ð"ð "ð "ð "ð "ñ "ô "ð "ð( ˆ,‰.Œ.€ð
E)ð E)ð E)ðP-ð -ð -ð`,ð ,ð ,ð1ð 1ð 1ð 1ð~Nð Nð Nð Nð N�ñ Nô Nð Nðbð ð ð ðH.ð .ð .ð0Bð Bð Bð> 3:ð 7Àgð 7ð 7ð 7ð 7ð 7ðt>ð >ð >ðB Ôð ,ð  ,ñ Ôð ,ðR !#ð -ð -ð -ð -ð -ð` ð ð ð ð ð ð$°¸Bð ð ð ð ð ðDS°¸Rð Sð Sð Sð Sð Sð 7<ð \ð \ð \ð \ð \ð \ð \r   