§
    HŠtjã  ã                   óò   — d Z ddlmZmZmZ ddlZ ej        e¦  «        Zddl	m
Z
mZ ddlZddlmZ ddlmZ g d¢Z G d„ d	e¦  «        Z G d
„ de¦  «        Zd„ Z G d„ de¦  «        Z	 	 	 dd„Z	 	 dd„ZdS )z7
passlib.utils.decor -- helper decorators & properties
é    )Úabsolute_importÚdivisionÚprint_functionN)ÚwrapsÚupdate_wrapper)Úwarn)ÚPY3)ÚclasspropertyÚhybrid_methodÚmemoize_single_valueÚmemoized_propertyÚdeprecated_functionÚdeprecated_methodc                   ó4   — e Zd ZdZd„ Zd„ Zed„ ¦   «         ZdS )r
   zjFunction decorator which acts like a combination of classmethod+property (limited to read-only properties)c                 ó   — || _         d S ©N©Úim_func©ÚselfÚfuncs     úQ/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/passlib/utils/decor.pyÚ__init__zclassproperty.__init__#   s   € ØˆŒˆˆó    c                 ó,   — |                       |¦  «        S r   r   ©r   ÚobjÚclss      r   Ú__get__zclassproperty.__get__&   s   € Ø�|Š|˜CÑ Ô Ð r   c                 ó   — | j         S )zpy3 compatible aliasr   ©r   s    r   Ú__func__zclassproperty.__func__)   s   € ð Œ|Ðr   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Úpropertyr"   © r   r   r
   r
       sS   € € € € € ØtÐtðð ð ð!ð !ð !ð ðð ñ „Xðð ð r   r
   c                   ó   — e Zd ZdZd„ Zd„ ZdS )r   z�
    decorator which invokes function with class if called as class method,
    and with object if called at instance level.
    c                 ó4   — || _         t          | |¦  «         d S r   )r   r   r   s     r   r   zhybrid_method.__init__4   s   € ØˆŒ	Ý�t˜TÑ"Ô"Ð"Ð"Ð"r   c                 ó‚   — |€|}t           rt          j        | j        |¦  «        S t          j        | j        ||¦  «        S r   )r	   ÚtypesÚ
MethodTyper   r   s      r   r   zhybrid_method.__get__8   s@   € Øˆ;ØˆCÝð 	9ÝÔ# D¤I¨sÑ3Ô3Ð3åÔ# D¤I¨s°CÑ8Ô8Ð8r   N)r#   r$   r%   r&   r   r   r(   r   r   r   r   .   s<   € € € € € ðð ð
#ð #ð #ð9ð 9ð 9ð 9ð 9r   r   c                 ó\   ‡ ‡— i Št          ‰ ¦  «        ˆˆ fd„¦   «         }ˆfd„}||_        |S )z�
    decorator for function which takes no args,
    and memoizes result.  exposes a ``.clear_cache`` method
    to clear the cached value.
    c                  óX   •— 	 ‰d         S # t           $ r Y nw xY w ‰¦   «         x} ‰d<   | S ©NT)ÚKeyError)ÚvalueÚcacher   s    €€r   Úwrapperz%memoize_single_value.<locals>.wrapperL   sK   ø€ ð	Ø˜”;ÐøÝð 	ð 	ð 	ØˆDð	øøøà"˜d™fœfÐ$ˆ��d‘Øˆs   ƒ ‹
—c                  ó4   •— ‰                       dd ¦  «         d S r0   )Úpop)r3   s   €r   Úclear_cachez)memoize_single_value.<locals>.clear_cacheU   s   ø€ Ø�	Š	�$˜ÑÔÐÐÐr   )r   r7   )r   r4   r7   r3   s   `  @r   r   r   D   s_   øø€ ð €Eå
ˆ4�[„[ðð ð ð ð ñ „[ððð ð ð ð à%€GÔà€Nr   c                   óF   — e Zd ZdZd„ Zd„ Zesed„ ¦   «         Zd„ Z	dd„Z
dS )	r   zM
    decorator which invokes method once, then replaces attr with result
    c                 óD   — || _         |j        | _        |j        | _        d S r   )r"   r#   r&   r   s     r   r   zmemoized_property.__init___   s   € ØˆŒØœˆŒØ”|ˆŒˆˆr   c                 ód   — |€| S |                       |¦  «        }t          || j        |¦  «         |S r   )r"   Úsetattrr#   )r   r   r   r2   s       r   r   zmemoized_property.__get__d   s6   € Øˆ;ØˆKØ—’˜cÑ"Ô"ˆÝ��T”] EÑ*Ô*Ð*Øˆr   c                 ó   — | j         S )z	py2 alias)r"   r!   s    r   r   zmemoized_property.im_funcm   s   € ð ”=Ð r   c                 óF   — |j                              | j        d¦  «         dS )z€
        class-level helper to clear stored value (if any).

        usage: :samp:`type(self).{attr}.clear_cache(self)`
        N)Ú__dict__r6   r#   )r   r   s     r   r7   zmemoized_property.clear_cacher   s$   € ð 	Œ×Ò˜œ¨Ñ-Ô-Ð-Ð-Ð-r   Nc                 óB   — |j                              | j        |¦  «        S )z€
        class-level helper to peek at stored value

        usage: :samp:`value = type(self).{attr}.clear_cache(self)`
        )r>   Úgetr#   )r   r   Údefaults      r   Ú
peek_cachezmemoized_property.peek_cachez   s   € ð Œ|×Ò ¤¨wÑ7Ô7Ð7r   r   )r#   r$   r%   r&   r   r   r	   r'   r   r7   rB   r(   r   r   r   r   [   s‚   € € € € € ðð ð$ð $ð $ð
ð ð ð ð !à	ð	!ð 	!ñ 
Œð	!ð.ð .ð .ð8ð 8ð 8ð 8ð 8ð 8r   r   TFc                 óv   ‡ ‡‡‡‡‡‡— ‰ €$‰rdŠ ndŠ ‰r‰ dz  Š ‰r‰ dz  Š ‰r‰ d‰z  z  Š ‰ dz  Š ˆˆˆˆ ˆˆˆfd„}|S )	ab  decorator to deprecate a function.

    :arg msg: optional msg, default chosen if omitted
    :kwd deprecated: version when function was first deprecated
    :kwd removed: version when function will be removed
    :kwd replacement: alternate name / instructions for replacing this function.
    :kwd updoc: add notice to docstring (default ``True``)
    Nz5the method %(mod)s.%(klass)s.%(name)s() is deprecatedz-the function %(mod)s.%(name)s() is deprecatedz as of Passlib %(deprecated)sz,, and will be removed in Passlib %(removed)sz, use %s insteadú.c                 óV  •‡ ‡‡‡— ‰ot          ‰ t          ¦  «        Š‰r ‰                      d t          ¦  «        j        Š t          ‰p‰ j        ‰ j        ‰‰
¬¦  «        Š‰r	ˆ ˆˆ	ˆfd„}n‰	‰z  Šˆ ˆfd„}t          |‰ ¦  «         ‰r’‰s‰
rŽ|j	        r‡d|j	        vr~‰pd}‰
s‰r%|dz  }‰
r|d‰
›�z  }‰r‰
r|dz  }|d	‰z  z  }|d
z  }|j	         
                    d¦  «                             d¦  «        s|xj	        dz  c_	        |xj	        d|›d�z  c_	        ‰rt          |¦  «        }|S )N)ÚmodÚnameÚ
deprecatedÚremovedc                  óà   •— ‰                      ¦   «         }‰r| d         n| d         j        }|                     |j        |j        ¬¦  «         t          ‰|z  t          d¬¦  «          ‰| i |¤ŽS )Nr   )ÚklassrF   é   ©Ú
stacklevel)ÚcopyÚ	__class__Úupdater#   r$   r   ÚDeprecationWarning)ÚargsÚkwdsÚtmprK   r   Úis_classmethodÚmsgÚoptss       €€€€r   r4   z3deprecated_function.<locals>.build.<locals>.wrapperº   ss   ø€ Ø—i’i‘k”k�Ø#1ÐH˜˜Qœ˜°t¸A´wÔ7H�Ø—
’
 ¤°UÔ5E�
ÑFÔFÐFÝ�S˜3‘YÕ 2¸qÐAÑAÔAÐAØ�t˜TÐ* TÐ*Ð*Ð*r   c                  óB   •— t          ‰t          d¬¦  «          ‰| i |¤ŽS )NrL   rM   )r   rR   )rS   rT   r   Útexts     €€r   r4   z3deprecated_function.<locals>.build.<locals>.wrapperÂ   s.   ø€ Ý�TÕ-¸!Ð<Ñ<Ô<Ð<Ø�t˜TÐ* TÐ*Ð*Ð*r   z.. deprecated::Ú z
    zand will be removed in version z, zuse %s insteadrD   ú ú
z
.. deprecated:: )Ú
isinstanceÚclassmethodr   Útyper"   Údictr$   r#   r   r&   ÚstripÚendswith)r   r4   ÚtxtrV   rX   rZ   Ú
_is_methodrH   Úfunc_modulerW   rI   ÚreplacementÚupdocs   `  @@@€€€€€€€r   Úbuildz"deprecated_function.<locals>.build®   sÜ  øøøøø€ Ø#ÐE­
°4½Ñ(EÔ(EˆØð 	5à—<’< ¥dÑ+Ô+Ô4ˆDÝØÐ.˜tœØ”Ø!Øð	ñ ô ˆð ð 	+ð+ð +ð +ð +ð +ð +ð +ð +ð +ð ˜‘:ˆDð+ð +ð +ð +ð +ð +õ 	�w Ñ%Ô%Ð%Øð 	A�jð 	A Gð 	AØ”?ð	AØ'8ÀÄÐ'OÐ'OØÐ" ˆCØð ˜+ð Ø�x‘�Øð LØ�CÀ'À'ÐKÑK�CØð :Øð $Ø˜t™˜ØÐ+¨kÑ9Ñ9�CØ�s‘
�Ø”?×(Ò(¨Ñ-Ô-×6Ò6°tÑ<Ô<ð (Ø�” 4Ñ'�”ØˆOŒOˆO¸3¸3¸3Ð@Ñ@ˆOŒOØð 	+Ý! 'Ñ*Ô*ˆGØˆr   r(   )rW   rH   rI   rh   rg   re   rf   ri   s   ``````` r   r   r   —   s¬   øøøøøøø€ ð €{Øð 	BØIˆCˆCàAˆCØð 	3ØÐ2Ñ2ˆCØð 	BØÐAÑAˆCØð 	4ØÐ%¨Ñ3Ñ3ˆCØˆs‰
ˆð)ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ðT €Lr   c                 ó,   — t          | ||||d¬¦  «        S )aZ  decorator to deprecate a method.

    :arg msg: optional msg, default chosen if omitted
    :kwd deprecated: version when method was first deprecated
    :kwd removed: version when method will be removed
    :kwd replacement: alternate name / instructions for replacing this method.
    :kwd updoc: add notice to docstring (default ``True``)
    T)re   )r   )rW   rH   rI   rh   rg   s        r   r   r   Ú   s(   € õ ˜s J°¸ÀØ*.ð0ñ 0ô 0ð 0r   )NNNTNFN)NNNTN)r&   Ú
__future__r   r   r   ÚloggingÚ	getLoggerr#   ÚlogÚ	functoolsr   r   r,   Úwarningsr   Úpasslib.utils.compatr	   Ú__all__Úobjectr
   r   r   r   r   r   r(   r   r   ú<module>rt      s  ððð ð AÐ @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ø €€€Ø€gÔ˜Ñ!Ô!€Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø €€€Ø Ð Ð Ð Ð Ð ð %Ð $Ð $Ð $Ð $Ð $ð	ð 	ð 	€ðð ð ð ð �Fñ ô ð ð9ð 9ð 9ð 9ð 9�Fñ 9ô 9ð 9ð,ð ð ð.%8ð %8ð %8ð %8ð %8˜ñ %8ô %8ð %8ðx HLØ5:Ø$(ðAð Að Að AðF FJØ"&ð0ð 0ð 0ð 0ð 0ð 0r   