Ë
    §ŒjÒI  ã                   óú   — d Z ddlmZ ddlmZmZ ddlmZmZm	Z	m
Z
 ddlmZ  G d„ de	«      Z G d	„ d
e	«      Z G d„ de«      Z G d„ de
«      Z G d„ d«      Z G d„ de«      ZeZddde
dœd„Z G d„ de«      ZeZy)zoThis module implements decorators for implementing other decorators
as well as some commonly used decorators.

é    )Úpartial)ÚisclassÚ	signatureé   )ÚBaseObjectProxyÚBoundFunctionWrapperÚCallableObjectProxyÚFunctionWrapper)Úformatargspecc                   ón   ‡ — e Zd Zˆ fd„Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z	ˆ xZ
S )Ú_AdapterFunctionCodec                 ó:   •— t         t        | �  |«       || _        y ©N)Úsuperr   Ú__init__Ú_self_adapter_code)ÚselfÚwrapped_codeÚadapter_codeÚ	__class__s      €úZ/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/wrapt/decorators.pyr   z_AdapterFunctionCode.__init__   s   ø€ ô 	Ô" DÑ2°<Ô@Ø".ˆÕó    c                 ó.   — | j                   j                  S r   )r   Úco_argcount©r   s    r   r   z _AdapterFunctionCode.co_argcount    ó   € à×&Ñ&×2Ñ2Ð2r   c                 ó.   — | j                   j                  S r   )r   Úco_coder   s    r   r   z_AdapterFunctionCode.co_code$   s   € à×&Ñ&×.Ñ.Ð.r   c                 ó.   — | j                   j                  S r   )r   Úco_flagsr   s    r   r    z_AdapterFunctionCode.co_flags(   s   € à×&Ñ&×/Ñ/Ð/r   c                 ó.   — | j                   j                  S r   )r   Úco_kwonlyargcountr   s    r   r"   z&_AdapterFunctionCode.co_kwonlyargcount,   s   € à×&Ñ&×8Ñ8Ð8r   c                 ó.   — | j                   j                  S r   )r   Úco_varnamesr   s    r   r$   z _AdapterFunctionCode.co_varnames0   r   r   )Ú__name__Ú
__module__Ú__qualname__r   Úpropertyr   r   r    r"   r$   Ú__classcell__©r   s   @r   r   r      sl   ø„ ô/ð ñ3ó ð3ð ñ/ó ð/ð ñ0ó ð0ð ñ9ó ð9ð ñ3ó ô3r   r   c                   ó^   ‡ — e Zd Zˆ fd„Zed„ «       Zed„ «       Zed„ «       Zed„ «       Zˆ xZ	S )Ú_AdapterFunctionSurrogatec                 ó:   •— t         t        | �  |«       || _        y r   )r   r,   r   Ú_self_adapter)r   ÚwrappedÚadapterr   s      €r   r   z"_AdapterFunctionSurrogate.__init__7   s   ø€ ô 	Ô'¨Ñ7¸Ô@Ø$ˆÕr   c                 ój   — t        | j                  j                  | j                  j                  «      S r   )r   Ú__wrapped__Ú__code__r.   r   s    r   r3   z"_AdapterFunctionSurrogate.__code__>   s,   € ä#Ø×Ñ×%Ñ% t×'9Ñ'9×'BÑ'Bó
ð 	
r   c                 ó.   — | j                   j                  S r   )r.   Ú__defaults__r   s    r   r5   z&_AdapterFunctionSurrogate.__defaults__D   s   € à×!Ñ!×.Ñ.Ð.r   c                 ó.   — | j                   j                  S r   )r.   Ú__kwdefaults__r   s    r   r7   z(_AdapterFunctionSurrogate.__kwdefaults__H   s   € à×!Ñ!×0Ñ0Ð0r   c                 ó,   — t        | j                  «      S r   )r   r.   r   s    r   Ú__signature__z'_AdapterFunctionSurrogate.__signature__L   s   € ä˜×+Ñ+Ó,Ð,r   )
r%   r&   r'   r   r(   r3   r5   r7   r9   r)   r*   s   @r   r,   r,   5   sX   ø„ ô%ð ñ
ó ð
ð
 ñ/ó ð/ð ñ1ó ð1ð ñ-ó ô-r   r,   c                   ó,   — e Zd Zed„ «       Zed„ «       Zy)Ú_BoundAdapterFunctionWrapperc                 ój   — t        | j                  j                  | j                  j                  «      S r   )r,   r2   Ú__func__Ú_self_parentr.   r   s    r   r=   z%_BoundAdapterFunctionWrapper.__func__S   s,   € ä(Ø×Ñ×%Ñ% t×'8Ñ'8×'FÑ'Fó
ð 	
r   c                 ó@   — t        | j                  j                  «      S r   )r   r>   r.   r   s    r   r9   z*_BoundAdapterFunctionWrapper.__signature__Y   s   € ä˜×*Ñ*×8Ñ8Ó9Ð9r   N)r%   r&   r'   r(   r=   r9   © r   r   r;   r;   Q   s(   „ àñ
ó ð
ð
 ñ:ó ñ:r   r;   c                   ób   ‡ — e Zd ZeZˆ fd„Zed„ «       Zed„ «       Zed„ «       Z	ed„ «       Z
ˆ xZS )Ú_AdapterFunctionWrapperc                 ó’   •— |j                  d«      }t        t        | �  |i |¤Ž t	        | j
                  |«      | _        || _        y )Nr0   )Úpopr   rB   r   r,   r2   Ú_self_surrogater.   )r   ÚargsÚkwargsr0   r   s       €r   r   z _AdapterFunctionWrapper.__init__b   sE   ø€ Ø—*‘*˜YÓ'ˆô 	Ô% tÑ5°tÐF¸vÒFÜ8¸×9IÑ9IÈ7ÓSˆÔØ$ˆÕr   c                 ó.   — | j                   j                  S r   )rE   r3   r   s    r   r3   z _AdapterFunctionWrapper.__code__k   s   € à×#Ñ#×,Ñ,Ð,r   c                 ó.   — | j                   j                  S r   )rE   r5   r   s    r   r5   z$_AdapterFunctionWrapper.__defaults__o   s   € à×#Ñ#×0Ñ0Ð0r   c                 ó.   — | j                   j                  S r   )rE   r7   r   s    r   r7   z&_AdapterFunctionWrapper.__kwdefaults__s   s   € à×#Ñ#×2Ñ2Ð2r   c                 ó.   — | j                   j                  S r   )rE   r9   r   s    r   r9   z%_AdapterFunctionWrapper.__signature__w   s   € à×#Ñ#×1Ñ1Ð1r   )r%   r&   r'   r;   Ú__bound_function_wrapper__r   r(   r3   r5   r7   r9   r)   r*   s   @r   rB   rB   ^   s^   ø„ à!=Ðô%ð ñ-ó ð-ð ñ1ó ð1ð ñ3ó ð3ð ñ2ó ô2r   rB   c                   ó   — e Zd Zd„ Zy)ÚAdapterFactoryc                 ó   — t        «       ‚r   )ÚNotImplementedError©r   r/   s     r   Ú__call__zAdapterFactory.__call__}   s   € Ü!Ó#Ð#r   N)r%   r&   r'   rR   r@   r   r   rN   rN   |   s   „ ó$r   rN   c                   ó$   ‡ — e Zd Zˆ fd„Zd„ Zˆ xZS )Ú_DelegatedAdapterFactoryc                 ó8   •— t         t        | �  «        || _        y r   )r   rT   r   Úfactory)r   rV   r   s     €r   r   z!_DelegatedAdapterFactory.__init__‚   s   ø€ äÔ&¨Ñ6Ô8Øˆ�r   c                 ó$   — | j                  |«      S r   )rV   rQ   s     r   rR   z!_DelegatedAdapterFactory.__call__‡   s   € Ø�|‰|˜GÓ$Ð$r   )r%   r&   r'   r   rR   r)   r*   s   @r   rT   rT   �   s   ø„ ôö
%r   rT   N©Úenabledr0   Úproxyc               óp   ‡ ‡‡‡‡— ‰ �dˆfd„	Šˆˆˆˆ fd„} ‰‰ |t         ¬«      S t        t         ‰‰‰¬«      S )aÓ  
    The decorator should be supplied with a single positional argument
    which is the `wrapper` function to be used to implement the
    decorator. This may be preceded by a step whereby the keyword
    arguments are supplied to customise the behaviour of the
    decorator. The `adapter` argument is used to optionally denote a
    separate function which is notionally used by an adapter
    decorator. In that case parts of the function `__code__` and
    `__defaults__` attributes are used from the adapter function
    rather than those of the wrapped function. This allows for the
    argument specification from `inspect.getfullargspec()` and similar
    functions to be overridden with a prototype for a different
    function than what was wrapped. The `enabled` argument provides a
    way to enable/disable the use of the decorator. If the type of
    `enabled` is a boolean, then it is evaluated immediately and the
    wrapper not even applied if it is `False`. If not a boolean, it will
    be evaluated when the wrapper is called for an unbound wrapper,
    and when binding occurs for a bound wrapper. When being evaluated,
    if `enabled` is callable it will be called to obtain the value to
    be checked. If `False`, the wrapper will not be called and instead
    the original wrapped function will be called directly instead.
    The `proxy` argument provides a way of passing a custom version of
    the `FunctionWrapper` class used in decorating the function.
    c                 ó(  •— |r…t        |t        «      r || «      }t        |«      sSi }i }t        |t        «      s t	        |«      dk(  r
|d   }|d d }t        |Ž }t        d|› d�||«       |d   }|r||_        t        | |||¬«      S  ‰| ||¬«      S )Né   éÿÿÿÿzdef adapterz: passr0   )r/   ÚwrapperrY   r0   )r/   r_   rY   )	Ú
isinstancerN   ÚcallableÚstrÚlenr   ÚexecÚ__annotations__rB   )r/   r_   rY   r0   ÚnsÚannotationsrZ   s         €r   Ú_buildzdecorator.<locals>._build³   s´   ø€ ÙÜ˜g¤~Ô6Ù% gÓ.�Gä Ô(Ø�Bð #%�Kä% g¬sÔ3Ü˜w›<¨1Ò,Ø*1°"©+˜KØ&-¨c¨r l˜GÜ"/°Ð"9˜ä˜; w i¨vÐ6¸¸BÔ?Ø  ™m�Gñ #Ø2=˜Ô/ä.Ø#¨W¸gÈwôð ñ  °'À7ÔKÐKr   c                 ó0  •‡ ‡— |€t        ‰ «      r|sˆˆ	ˆ
ˆˆ fd„}|S |d   }‰
}t        |«      t        u r|s|S d }|€t        ‰ «      r ‰ «       }n<‰}n9t        |«      r‰j                  d |«      }n‰j                  |t        |«      «      } ‰|||‰	«      S )Nc                 ó\   •— ‰}t        |«      t        u r|s| S d } ‰di ‰¤Ž} ‰| ||‰«      S )Nr@   )ÚtypeÚbool)Útarget_wrappedÚ_enabledÚtarget_wrapperrh   r0   rY   rG   r/   s      €€€€€r   Ú_capturez-decorator.<locals>._wrapper.<locals>._captureü   sF   ø€ ð  '�HÜ˜H“~¬Ñ-Ù'Ø#1Ð1Ø#'˜ñ &-Ñ%6¨vÑ%6�Nñ " .°.À(ÈGÓTÐTr   r   )r   rk   rl   Ú__get__)r/   ÚinstancerF   rG   rp   rm   rn   ro   rh   r0   rY   r_   s   `  `    €€€€r   Ú_wrapperzdecorator.<locals>._wrapperâ   s¸   ú€ ð* Ð¤G¨GÔ$4¹T÷
Uð Uð2  �ð
 " !™WˆNð ˆHÜ�H‹~¤Ñ%ÙØ)Ð)Ø�ð
 ÐÜ˜7Ô#ñ, &-£Y‘Nð$ &-‘Nô ˜8Ô$ð. &-§_¡_°T¸8Ó%D‘Nð0 &-§_¡_°X¼tÀH»~Ó%N�Nñ ˜.¨.¸(ÀGÓLÐLr   )r0   rX   )NN)Ú	decoratorr   )r_   rY   r0   rZ   rs   rh   s   ```` @r   rt   rt   •   s>   ü€ ð4 Ðõ&	L÷^f	Mñ^ �g˜x´Ô;Ð;ô ”y¨'¸7È%ÔPÐPr   c                   ó4   ‡ — e Zd ZdZddœˆ fd„
Zd„ Zd„ Zˆ xZS )Ú_StateBindingWrappera<  A descriptor decorator that binds the owner instance to wrappers
    produced by a wrapper factory method.

    When applied on top of a method decorated with ``function_wrapper``
    or ``decorator``, it intercepts the descriptor ``__get__`` so that
    when the method is accessed through an instance, the owner instance
    is automatically attached as an attribute on the resulting wrapper
    via ``__self_setattr__``.

    The *name* keyword argument controls the attribute name under which
    the owner instance is stored on the wrapper (default ``"state"``).
    Ústate)Únamec                ó2   •— t         ‰| �  d «       || _        y r   )r   r   Ú
_self_name)r   rx   r   s     €r   r   z_StateBindingWrapper.__init__´  s   ø€ ô 	‰Ñ˜Ôàˆ�r   c                 ó   — || _         | S r   )r2   )r   Úwrapper_factorys     r   rR   z_StateBindingWrapper.__call__¼  s   € ð +ˆÔàˆr   c                 ór   ‡‡‡— ‰€| S | j                   j                  ‰|«      Š| j                  Šˆˆˆfd„}|S )Nc                 ó<   •—  ‰| «      }|j                  ‰‰«       |S r   )Ú__self_setattr__)Úfuncr_   rr   rx   r|   s     €€€r   Ú_bindz+_StateBindingWrapper.__get__.<locals>._bindÓ  s$   ø€ Ù% dÓ+ˆGð
 ×$Ñ$ T¨8Ô4àˆNr   )r2   rq   rz   )r   rr   Úownerr�   rx   r|   s    `  @@r   rq   z_StateBindingWrapper.__get__Ä  s?   ú€ ð
 ÐØˆKð
 ×*Ñ*×2Ñ2°8¸UÓCˆà�‰ˆö	ð ˆr   )r%   r&   r'   Ú__doc__r   rR   rq   r)   r*   s   @r   rv   rv   ¦  s   ø„ ñð  'ö òör   rv   r   )rƒ   Ú	functoolsr   Úinspectr   r   Ú	__wrapt__r   r   r	   r
   Ú	argumentsr   r   r,   r;   rB   rN   rT   Úadapter_factoryrt   rv   Úbind_state_to_wrapperr@   r   r   Ú<module>rŠ      s›   ðñõ
 ß &÷ó õ %ô3Ð.ô 3ô<-Ð 3ô -ô8
:Ð#7ô 
:ô2˜oô 2÷<$ñ $ô
%˜~ô %ð +€ðDQ¨$¸ÀOô DQôb7˜?ô 7ðt -Ñ r   