Ë
    �š¾j[$  ã                   ó
  — d Z ddlmZmZmZmZ ddlmZ ddlm	Z	m
Z
mZmZ ddlmZmZmZ  e«       Zd„ Zd„ Zd	„ Zd
„ Zd„ Z G d„ de	«      Z G d„ d«      Z G d„ dee«      Z G d„ de
«      Z G d„ dee«      Z	 ddddddœd„Zy)a   The `with_signature` decorator: override the signature (and related
introspection attributes) of a wrapped callable without mutating the wrapped
function itself. Accepts a prototype callable, a prebuilt `inspect.Signature`,
or a factory that derives a signature from the wrapped function at decoration
time.

This replaces the need for the `adapter=` argument of `wrapt.decorator`,
which is planned for deprecation.
é    )Ú
CO_VARARGSÚCO_VARKEYWORDSÚ	ParameterÚ	Signature)Ú	signatureé   )ÚBaseObjectProxyÚBoundFunctionWrapperÚCallableObjectProxyÚFunctionWrapper)Ú_BOUND_DOC_PROPERTYÚ_DOC_PROPERTYÚ_NO_DOC_OVERRIDEc                 óP   ‡ ‡— d‰ j                  d«      › �Šˆ ˆfd„}t        |«      S )aQ  Read-only property that memoizes its derivation in a `_self_*` slot.

    `functools.cached_property` is unusable on ObjectProxy subclasses: wrapt
    overrides `__dict__` with a property returning the wrapped object's dict,
    so cached_property's `instance.__dict__[name] = value` would mutate the
    wrapped function. Storing under a `_self_*` name routes through wrapt's
    own setattr handling and lands in the proxy's real instance dict. Using
    a `@property` (data descriptor) also ensures we win over any value
    copied into the instance dict by `FunctionWrapper.__init__`.
    Ú_self_cached_Ú_c                 ó€   •— t        | ‰t        «      }|t        u r#| j                  ‰«      }| j                  ‰|«       |S ©N)ÚgetattrÚ_MISSINGÚ_deriveÚ__self_setattr__)ÚselfÚvalueÚattrÚslots     €€úY/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/wrapt/signature.pyÚgetterz_cached.<locals>.getter&   s<   ø€ Ü˜˜d¤HÓ-ˆØ”HÑØ—L‘L Ó&ˆEØ×!Ñ! $¨Ô.Øˆó    )ÚlstripÚproperty)r   r   r   s   ` @r   Ú_cachedr"      s-   ù€ ð ˜4Ÿ;™; sÓ+Ð,Ð-€Dõô �FÓÐr   c                 ó  — | j                   j                  «       D �ci c]5  }|j                  t        j                  ur|j
                  |j                  “Œ7 }}| j                  t        j                  ur| j                  |d<   |S c c}w )NÚreturn)Ú
parametersÚvaluesÚ
annotationr   ÚemptyÚnameÚreturn_annotationr   )ÚsigÚpÚanns      r   Ú_derive_annotationsr.   0   sx   € ð —‘×&Ñ&Ó(öàØ�<‰<œyŸ™Ñ.ð 	
�‰�—‘Ñð€Cð ð
 ×Ñ¤I§O¡OÑ3Ø×-Ñ-ˆˆH‰Ø€Jùòs   �:Bc                 ób   — t        d„ | j                  j                  «       D «       «      }|xs d S )Nc              3   óÄ   K  — | ]X  }|j                   t        j                  t        j                  fv r*|j                  t        j
                  ur|j                  –— ŒZ y ­wr   )Úkindr   ÚPOSITIONAL_ONLYÚPOSITIONAL_OR_KEYWORDÚdefaultr(   ©Ú.0r,   s     r   ú	<genexpr>z#_derive_defaults.<locals>.<genexpr><   sI   è ø€ ò àØ�6‰6”i×/Ñ/´×1PÑ1PÐQÑQØ�I‰IœYŸ_™_Ñ,ð 	
�	�	ñùs   ‚AA )Útupler%   r&   )r+   Údefaultss     r   Ú_derive_defaultsr:   ;   s3   € Üñ à—‘×&Ñ&Ó(ôó €Hð Ò�tÐr   c                 ó   — | j                   j                  «       D �ci c]Q  }|j                  t        j                  u r3|j
                  t        j                  ur|j                  |j
                  “ŒS }}|xs d S c c}w r   )r%   r&   r1   r   ÚKEYWORD_ONLYr4   r(   r)   )r+   r,   Ú
kwdefaultss      r   Ú_derive_kwdefaultsr>   E   sn   € ð —‘×&Ñ&Ó(öàØ�6‰6”Y×+Ñ+Ñ+°·	±	ÄÇÁÑ0Pð 	
�‰�—	‘	Ñð€Jð ð
 Ò˜Ðùòs   �AA;c                 óº  — g g g }}}d x}}| j                   j                  «       D ]ü  }|j                  t        j                  u r|j                  |j                  «       Œ;|j                  t        j                  u r|j                  |j                  «       Œs|j                  t        j                  u r|j                  }Œœ|j                  t        j                  u r|j                  |j                  «       ŒÔ|j                  t        j                  u sŒñ|j                  }Œþ ||z   |z   }|r|j                  |«       |r|j                  |«       t        |«      S r   )r%   r&   r1   r   r2   Úappendr)   r3   ÚVAR_POSITIONALr<   ÚVAR_KEYWORDr8   )r+   Úpos_onlyÚ	pos_or_kwÚkw_onlyÚvar_posÚvar_kwr,   Únamess           r   Ú_derive_varnamesrI   N   s  € Ø#% r¨2˜ˆi€HØÐ€GˆfØ�^‰^×"Ñ"Ó$ò 
ˆØ�6‰6”Y×.Ñ.Ñ.Ø�O‰O˜AŸF™FÕ#Ø�V‰V”y×6Ñ6Ñ6Ø×Ñ˜QŸV™VÕ$Ø�V‰V”y×/Ñ/Ñ/Ø—f‘f‰GØ�V‰V”y×-Ñ-Ñ-Ø�N‰N˜1Ÿ6™6Õ"Ø�V‰V”y×,Ñ,Ò,Ø—V‘V‰Fð
ð �yÑ  7Ñ*€EÙØ�‰�WÔÙØ�‰�VÔÜ�‹<Ðr   c                   óx   ‡ — e Zd ZdZˆ fd„Zd„ Z ed«      Z ed«      Z ed«      Z	 ed«      Z
 ed«      Zˆ xZS )	Ú_SignatureCodezÔCode-object proxy deriving argument-related co_* attrs from a Signature.

    Non-argument bits (co_flags for coroutine/generator, co_filename, etc.)
    fall through to the wrapped function's real __code__.
    c                 ó2   •— t         ‰| �  |«       || _        y r   ©ÚsuperÚ__init__Ú_self_signature©r   Úwrappedr   Ú	__class__s      €r   rO   z_SignatureCode.__init__k   ó   ø€ Ü‰Ñ˜Ô!Ø(ˆÕr   c                 óâ  ‡— | j                   }|dk(  rLt        j                  t        j                  fŠt	        ˆfd„|j
                  j                  «       D «       «      S |dk(  r*t	        d„ |j
                  j                  «       D «       «      S |dk(  r*t	        d„ |j
                  j                  «       D «       «      S |dk(  rt        |«      S |dk(  r�|j
                  j                  «       D �ch c]  }|j                  ’Œ c}Š| j                  j                  t        t        z   z  }t        j                  ‰v r	|t        z  }t        j                  ‰v r	|t        z  }|S t        |«      ‚c c}w )	NÚco_argcountc              3   ó:   •K  — | ]  }|j                   ‰v –— Œ y ­wr   )r1   )r6   r,   Úkindss     €r   r7   z)_SignatureCode._derive.<locals>.<genexpr>s   s   øè ø€ ÒH¨1�q—v‘v ”ÑHùs   ƒÚco_posonlyargcountc              3   óT   K  — | ]   }|j                   t        j                  u –— Œ" y ­wr   )r1   r   r2   r5   s     r   r7   z)_SignatureCode._derive.<locals>.<genexpr>u   s$   è ø€ ò Ø89�—‘œ)×3Ñ3Ô3ñùó   ‚&(Úco_kwonlyargcountc              3   óT   K  — | ]   }|j                   t        j                  u –— Œ" y ­wr   )r1   r   r<   r5   s     r   r7   z)_SignatureCode._derive.<locals>.<genexpr>y   s$   è ø€ ò Ø56�—‘œ)×0Ñ0Ô0ñùr[   Úco_varnamesÚco_flags)rP   r   r2   r3   Úsumr%   r&   rI   r1   Ú__wrapped__r_   r   r   rA   rB   ÚAttributeError)r   r   r+   r,   ÚflagsrX   s        @r   r   z_SignatureCode._deriveo   sM  ø€ Ø×"Ñ"ˆØ�=Ò Ü×.Ñ.´	×0OÑ0OÐPˆEÜÓH°·±×0EÑ0EÓ0GÔHÓHÐHØÐ'Ò'Üñ Ø=@¿^¹^×=RÑ=RÓ=Tôó ð ð Ð&Ò&Üñ Ø:=¿.¹.×:OÑ:OÓ:Qôó ð ð �=Ò Ü# CÓ(Ð(Ø�:ÒØ%(§^¡^×%:Ñ%:Ó%<Ö= �Q—V“VÒ=ˆEØ×$Ñ$×-Ñ-´*¼~Ñ2MÐ0NÑNˆEÜ×'Ñ'¨5Ñ0ØœÑ#�Ü×$Ñ$¨Ñ-ØœÑ'�ØˆLÜ˜TÓ"Ð"ùò >s   Ã.E,rV   rY   r\   r^   r_   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__rO   r   r"   rV   rY   r\   r^   r_   Ú__classcell__©rS   s   @r   rK   rK   d   sJ   ø„ ñô)ò#ñ2 ˜-Ó(€KÙ Ð!5Ó6ÐÙÐ 3Ó4ÐÙ˜-Ó(€KÙ�zÓ"„Hr   rK   c                   óf   — e Zd ZdZd„ Zed„ «       Z ed«      Z ed«      Z	 ed«      Z
 ed«      Zy)	Ú_SignatureMixinzEShared Signature-derived introspection attrs for wrapper + surrogate.c                 óÚ   — | j                   }|dk(  rt        |«      S |dk(  rt        |«      S |dk(  rt        |«      S |dk(  r t	        | j
                  j                  |«      S t        |«      ‚)NÚ__annotations__Ú__defaults__Ú__kwdefaults__Ú__code__)rP   r.   r:   r>   rK   ra   rp   rb   )r   r   r+   s      r   r   z_SignatureMixin._derive’   st   € Ø×"Ñ"ˆØÐ$Ò$Ü& sÓ+Ð+Ø�>Ò!Ü# CÓ(Ð(ØÐ#Ò#Ü% cÓ*Ð*Ø�:ÒÜ! $×"2Ñ"2×";Ñ";¸SÓAÐAÜ˜TÓ"Ð"r   c                 ó   — | j                   S r   )rP   ©r   s    r   Ú__signature__z_SignatureMixin.__signature__ž   s   € à×#Ñ#Ð#r   rm   rn   ro   rp   N)rd   re   rf   rg   r   r!   rs   r"   rm   rn   ro   rp   © r   r   rk   rk   �   sJ   „ ÙOò
#ð ñ$ó ð$ñ Ð/Ó0€OÙ˜>Ó*€LÙÐ-Ó.€NÙ�zÓ"�Hr   rk   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )Ú_SignatureFunctionSurrogatea  Function surrogate exposing Signature-derived introspection attrs.

    Used as __func__ of a bound wrapper so that inspect.signature -- which
    treats the bound wrapper as a MethodType and consults __func__ -- sees
    our override and strips self/cls correctly.
    c                 ó2   •— t         ‰| �  |«       || _        y r   rM   rQ   s      €r   rO   z$_SignatureFunctionSurrogate.__init__°   rT   r   )rd   re   rf   rg   rO   rh   ri   s   @r   rv   rv   ¨   s   ø„ ñ÷)ð )r   rv   c                   ó0   — e Zd ZeZed„ «       Zed„ «       Zy)Ú_BoundSignatureFunctionWrapperc                 ój   — t        | j                  j                  | j                  j                  «      S r   )rv   ra   Ú__func__Ú_self_parentrP   rr   s    r   r{   z'_BoundSignatureFunctionWrapper.__func__¸   s,   € ä*Ø×Ñ×%Ñ% t×'8Ñ'8×'HÑ'Hó
ð 	
r   c                 ó.   — | j                   j                  S r   )r|   rP   rr   s    r   rs   z,_BoundSignatureFunctionWrapper.__signature__¾   s   € à× Ñ ×0Ñ0Ð0r   N)rd   re   rf   r   rg   r!   r{   rs   rt   r   r   ry   ry   µ   s-   „ Ø!€Gàñ
ó ð
ð
 ñ1ó ñ1r   ry   c                   ó:   ‡ — e Zd ZeZeZefˆ fd„	Ze	d„ «       Z
ˆ xZS )Ú_SignatureFunctionWrapperc                 óB   •— t         ‰| �  ||«       || _        || _        y r   )rN   rO   rP   Ú	_self_doc)r   rR   Úwrapperr   ÚdocrS   s        €r   rO   z"_SignatureFunctionWrapper.__init__È   s!   ø€ Ü‰Ñ˜ 'Ô*Ø(ˆÔØˆ�r   c                 óB   — t        | j                  | j                  «      S r   )rv   ra   rP   rr   s    r   r{   z"_SignatureFunctionWrapper.__func__Í   s   € ä*¨4×+;Ñ+;¸T×=QÑ=QÓRÐRr   )rd   re   rf   r   rg   ry   Ú__bound_function_wrapper__r   rO   r!   r{   rh   ri   s   @r   r   r   Ã   s,   ø„ Ø€Gà!?Ðà8Hõ ð
 ñSó ôSr   r   N)Ú	prototyper   Úfactoryrƒ   c               óœ   ‡‡‡‡— t        d„ ‰‰‰fD «       «      }|dk(  rt        d«      ‚|dkD  rt        d«      ‚ˆˆˆˆfd„}| €|S  || «      S )aç  Override the signature of a wrapped callable.

    Exactly one of `prototype`, `signature`, or `factory` must be supplied:

    - `prototype`: a callable whose signature will be used.
    - `signature`: a prebuilt `inspect.Signature` object.
    - `factory`: a callable `factory(wrapped)` invoked at decoration time
      that returns either a `Signature` or a prototype callable, or a
      tuple of `(signature_or_prototype, docstring)` to override the
      docstring at the same time.

    The docstring may also be overridden by supplying `doc`, in which case
    a docstring from the factory is ignored. When neither is supplied the
    wrapper reports the docstring of the wrapped function as normal.

    The resulting wrapper exposes the override via `__signature__`, and
    derives `__annotations__`, `__defaults__`, `__kwdefaults__`, and the
    argument-related attributes of `__code__` from the same source. The
    wrapped function is not mutated. Calling behaviour is unchanged.
    c              3   ó$   K  — | ]  }|d u–— Œ
 y ­wr   rt   )r6   Úxs     r   r7   z!with_signature.<locals>.<genexpr>ê   s   è ø€ ÒK a�A˜T”MÑKùs   ‚r   zBwith_signature requires one of prototype=, signature=, or factory=r   zFwith_signature accepts only one of prototype=, signature=, or factory=c                 óÜ   •— d„ }‰€t         n‰}‰	�‰	}nL‰�t        ‰«      }n> ‰| «      }t        |t        «      r	|\  }}‰€|}t        |t        «      r|n
t        |«      }t        | |||«      S )Nc                 ó   —  | |i |¤ŽS r   rt   )rR   ÚinstanceÚargsÚkwargss       r   Ú_wrapperz4with_signature.<locals>._decorator.<locals>._wrapperõ   s   € Ù˜DÐ+ FÑ+Ð+r   )r   Ú_inspect_signatureÚ
isinstancer8   r   r   )
rR   r�   Úresolved_docÚresolvedÚproducedÚproduced_docrƒ   r‡   r†   r   s
         €€€€r   Ú
_decoratorz"with_signature.<locals>._decoratorô   sŠ   ø€ ò	,ð ,/¨;Õ'¸CˆàÐ Ø ‰HØÐ"Ü)¨)Ó4‰Há˜wÓ'ˆHÜ˜(¤EÔ*Ø)1Ñ&�˜,Ø�;Ø#/�Lô ˜h¬	Ô2ñ ä'¨Ó1ð ô )¨°(¸HÀlÓSÐSr   )r`   Ú	TypeError)rR   r†   r   r‡   rƒ   Ú	specifiedr—   s    ````  r   Úwith_signaturerš   Ò   sj   û€ ô0 ÑK¨I°yÀ'Ð+JÔKÓK€IØ�A‚~ÜØPó
ð 	
ð �1‚}ÜØTó
ð 	
÷Tð0 €ØÐÙ�gÓÐr   r   )rg   Úinspectr   r   r   r   r   r‘   Ú	__wrapt__r	   r
   r   r   rƒ   r   r   r   Úobjectr   r"   r.   r:   r>   rI   rK   rk   rv   ry   r   rš   rt   r   r   ú<module>rž      s¤   ðñ÷ EÓ DÝ 3÷ó ÷ FÑ Eá‹8€òò.òòòô,(#�_ô (#÷V#ñ #ô2
) /Ð3Fô 
)ô1Ð%9ô 1ôS °ô Sð  ð<Ø"&°$ÀÈ$õ<r   