
    <Bh=                       S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	  SSK
Jr  SSKJr  \(       a6  SSKJrJr  SS	KJrJrJrJrJr  SS
KJr  \" S5      r\" S5      r\" S\\   S9rSSKJr   " S S\5      r " S S5      r\" \5      r g)z!Tools to aid in deprecating code.    )annotationsN)SUPPRESSAction)wraps)
ModuleType)TYPE_CHECKING)ArgumentParser	Namespace)AnyCallable	ParamSpecSelfTypeVar)VersionTP
ActionType)bound   )__version__c                      \ rS rSrSrg)DeprecatedError    N)__name__
__module____qualname____firstlineno____static_attributes__r       2lib/python3.13/site-packages/conda/deprecations.pyr   r      s    r    r   c                     \ rS rSr% S\S'   S\S'   S\S'   SS jr\SS	 j5       rSS
 jrSS\	S.             SS jjr
SSS\	S.                 SS jjrSS\S.               SS jjrSSS.           SS jjrSS\	S.                 S S jjrSS\	S.               S!S jjrS"S jr              S#S jrSrg)$DeprecationHandler"   
str | None_versiontuple[int, ...] | None_version_tuplezVersion | None_version_objectc                J    Xl         U R                  U5      U l        SU l        g)zFactory to create a deprecation handle for the specified version.

:param version: The version to compare against when checking deprecation statuses.
N)r&   _get_version_tupler(   r)   )selfversions     r!   __init__DeprecationHandler.__init__'   s&    
   #55g>#r    c                     [        S U R                  5       R                  S5      5       5      =(       d    S$ ! [        [        4 a     gf = f)zlReturn version as non-empty tuple of ints if possible, else None.

:param version: Version string to parse.
c              3  8   #    U  H  n[        U5      v   M     g 7fN)int).0parts     r!   	<genexpr>8DeprecationHandler._get_version_tuple.<locals>.<genexpr>9   s     J/ItT/Is   .N)tuplestripsplitAttributeError
ValueError)r-   s    r!   r+   %DeprecationHandler._get_version_tuple2   sE    	Jw}}/D/DS/IJJRdR
+ 		s   69 AAc                ,   U R                   (       a'  U R                  U5      =n(       a  U R                   U:  $ SSKJn  U R                  c   U" U R
                  5      U l        U R                  U" U5      :  $ ! [         a    U" S5      U l         N.f = f)zmTest whether own version is less than the given version.

:param version: Version string to compare against.
r   )parsez0.0.0.dev0+placeholder)r(   r+   packaging.versionr@   r)   r&   	TypeError)r,   r-   version_tupler@   s       r!   _version_less_than%DeprecationHandler._version_less_than=   s    
 T5L5LW5U$UM$U&&66
 	,'G',T]]';$ ##eGn44  G',-E'F$Gs   A9 9BBNr   )addendumstackdeprecation_typec               ,   ^ ^^^^^ SUUUUU U4S jjnU$ )aJ  Deprecation decorator for functions, methods, & classes.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param addendum: Optional additional messaging. Useful to indicate what to do instead.
:param stack: Optional stacklevel increment.
c                   >^ ^^ TR                  TTT R                   ST R                   3TTS9u  mmT(       d  [        T5      e[	        T 5      SUU UU	4S jj5       nU$ )Nr8   deprecate_in	remove_inprefixrF   rH   c                 F   > [         R                  " TTST-   S9  T" U 0 UD6$ N   
stacklevel)warningswarn)argskwargscategoryfuncmessagerG   s     r!   innerHDeprecationHandler.__call__.<locals>.deprecated_decorator.<locals>.innerr   s'    gxAIFT,V,,r    rV   zP.argsrW   zP.kwargsreturnr   _generate_messager   r   r   r   )
rY   r[   rX   rZ   rF   rL   rH   rM   r,   rG   s
   ` @@r!   deprecated_decorator9DeprecationHandler.__call__.<locals>.deprecated_decoratorc   sw     $ 6 6)#//*!D,=,=+>?!!1 !7 !Hg %g.. 4[- - -
 Lr    rY   Callable[P, T]r^   rd   r   )r,   rL   rM   rF   rG   rH   ra   s   `````` r!   __call__DeprecationHandler.__call__R   s    "	 	. $#r    )renamerF   rG   rH   c          	     4   ^ ^^^^^^^ SUUUUUUU U4S jjnU$ )a  Deprecation decorator for keyword arguments.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param argument: The argument to deprecate.
:param rename: Optional new argument name.
:param addendum: Optional additional messaging. Useful to indicate what to do instead.
:param stack: Optional stacklevel increment.
c           
        >^ ^^ T
R                  TTT R                   ST R                   ST S3T	(       a  T(       d  ST	 S3OTTS9u  mmT(       d  [        T5      e[	        T 5      SUUU UU	U4S jj5       nU$ )	Nr8   ()zUse 'z
' instead.rK   c                    > TU;   aD  [         R                  " TTST-   S9  UR                  TS 5      nT(       a  UR                  TU5        T" U 0 UD6$ rP   )rT   rU   pop
setdefault)	rV   rW   valueargumentrX   rY   rZ   rg   rG   s	      r!   r[   HDeprecationHandler.argument.<locals>.deprecated_decorator.<locals>.inner   sV     v%MM'8E	J #JJx6E))&%8T,V,,r    r]   r_   )rY   r[   rX   rZ   rF   rp   rL   rH   rM   rg   r,   rG   s   ` @@r!   ra   9DeprecationHandler.argument.<locals>.deprecated_decorator   s     $ 6 6)#//*!D,=,=+>azK 39eF8:.x!1 !7 	!Hg %g.. 4[
- 
- 
- Lr    rc   r   )	r,   rL   rM   rp   rg   rF   rG   rH   ra   s	   ```````` r!   rp   DeprecationHandler.argument|   s    *	 	B $#r    c               l   ^ ^^^^^  " UUUUU U4S jS[         5      n[        UR                  Xs40 5      $ )z9Wraps any argparse.Action to issue a deprecation warning.c                  |   >^  \ rS rSr% S\S'   S\S'   S	U UUUUU4S jjr S
           SU U4S jjjrSrU =r$ )3DeprecationHandler.action.<locals>.DeprecationMixin   type[Warning]rX   strhelpc                $  > [         TU ]  " U0 UD6  T
R                  TT	U R                  (       a  SU R                  S    S3OSU R                   S3TTS9u  p4U(       d  [        U5      eX0l        X@l        U R                  [        La  X@l        g g )N`rK   )
superr.   r`   option_stringsdestr   rX   deprecationrz   r   )
inner_selfrV   rW   rX   rZ   	__class__rF   rL   rH   rM   r,   s        r!   r.   <DeprecationHandler.action.<locals>.DeprecationMixin.__init__   s     $1&1$($:$:!-'
 &44 J55b9:!<  ! 13%%5 %; %!   )'22&.#)0&??(2&-O 3r    c                   > SSK Jn  X5La-  [        R                  " U R                  U R
                  ST-   S9  [        TU ]  XX45        g )Nr   )NULL   rR   )conda.common.constantsr   rT   rU   r   rX   r~   re   )r   parser	namespacevaluesoption_stringr   r   rG   s         r!   re   <DeprecationHandler.action.<locals>.DeprecationMixin.__call__   sD     8%MM".."++#$u9  FJr    r   )r   r   rV   r   rW   r   r^   Noner2   )r   r   r   r	   r   r
   r   r   r   r%   r^   r   )	r   r   r   r   __annotations__r.   re   r   __classcell__)r   rF   rL   rH   rM   r,   rG   s   @r!   DeprecationMixinrv      sh    ##I. .@ -1K K&K %K 	K
  *K K Kr    r   )r   typer   )r,   rL   rM   actionrF   rG   rH   r   s   ``` ``` r!   r   DeprecationHandler.action   s1    0	K 0	Kv 0	Kd FOO&6%?DDr    )rF   rG   c               T    U R                  UUU R                  U5      S   USU-   S9  g)a3  Deprecation function for modules.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param addendum: Optional additional messaging. Useful to indicate what to do instead.
:param stack: Optional stacklevel increment.
r   rQ   )rL   rM   topicrF   rG   N)r   _get_module)r,   rL   rM   rF   rG   s        r!   moduleDeprecationHandler.module   s8     	

%""5)!,e) 	 	
r    c                  ^^^^
^^^ U R                  T5      u  nmU R                  UUT ST 3UUS9u  m
mT
(       d  [        T5      e[        USS5      mSU
UUUUUU4S jjn	Xl        g)aa  Deprecation function for module constant/global.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param constant:
:param value:
:param addendum: Optional additional messaging. Useful to indicate what to do instead.
:param stack: Optional stacklevel increment.
r8   rK   __getattr__Nc                   > U T:X  a  [         R                  " TTST-   S9  T$ T(       a  T" U 5      $ [        ST SU  S35      e)N   rR   zmodule 'z' has no attribute '')rT   rU   r<   )namerX   constantfullnamerZ   rG   super_getattrro   s    r!   r   0DeprecationHandler.constant.<locals>.__getattr__1  sM    xgxAIF$T** 8H:5I$q!QRRr    )r   ry   r^   r   )r   r`   r   getattrr   )r,   rL   rM   r   ro   rF   rG   rH   r   r   rX   r   rZ   r   s      `` `   @@@@r!   r   DeprecationHandler.constant  s    *  ++E2 22%Zq
+- 3 
' !'**  t<	S 	S )r    c                   U R                  UUUUUS9u  pxU(       d  [        U5      e[        R                  " XSU-   S9  g)a]  Deprecation function for a topic.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param topic: The topic being deprecated.
:param addendum: Optional additional messaging. Useful to indicate what to do instead.
:param stack: Optional stacklevel increment.
rK   rQ   rR   N)r`   r   rT   rU   )	r,   rL   rM   r   rF   rG   rH   rX   rZ   s	            r!   r   DeprecationHandler.topic=  sO    & !22%- 3 
 !'** 	gAI>r    c                    [         R                  " SU-   5      n UR                  R                  n[	        [         R
                  R                  5       5       HL  n[        U[        5      (       d  M  [        US5      (       d  M-  UR                  U:X  d  M?  XDR                  4s  $    SSKnUR                  U5      nUb  XfR                  4$  [!        S5      e! [         a     N=f = f! [         a     N'f = f)zDetect the module from which we are being called.

:param stack: The stacklevel increment.
:return: The module and module name.
rQ   __file__r   Nz&unable to determine the calling module)sys	_getframef_codeco_filenamer9   modulesr   
isinstancer   hasattrr   r   r<   inspect	getmodule
IndexErrorr   )r,   rG   framefilenameloadedr   r   s          r!   r   DeprecationHandler._get_module_  s    	1MM!e),E9 <<33 $CKK$6$6$89F%fj99 "6:66 (2 &88 : &&u-F!00 " FGG+ "   		s"   C* C 
C'&C'*
C76C7c          	         U R                  U5      (       a  [        nSU S3nO'U R                  U5      (       a	  UnSU S3nOSnSU S3nUSR                  [        SX7U/5      5      4$ )a  Generate the standardized deprecation message and determine whether the
deprecation is pending, active, or past.

:param deprecate_in: Version in which code will be marked as deprecated.
:param remove_in: Version in which code is expected to be removed.
:param prefix: The message prefix, usually the function name.
:param addendum: Additional messaging. Useful to indicate what to do instead.
:param deprecation_type: The warning type to use for active deprecations.
:return: The warning category (if applicable) and the message.
z.is pending deprecation and will be removed in r8   z%is deprecated and will be removed in Nzwas slated for removal in  )rD   PendingDeprecationWarningjoinfilter)r,   rL   rM   rN   rF   rH   rX   warnings           r!   r`   $DeprecationHandler._generate_message  s    ( ""<000HFykQRSG$$Y//'H=i[JGH29+Q?G HHVD6H"=>?
 	
r    )r&   r)   r(   )r,   r   r-   ry   r^   r   )r-   ry   r^   r'   )r,   r   r-   ry   r^   bool)r,   r   rL   ry   rM   ry   rF   r%   rG   r3   rH   rx   r^   *Callable[[Callable[P, T]], Callable[P, T]])r,   r   rL   ry   rM   ry   rp   ry   rg   r%   rF   r%   rG   r3   rH   rx   r^   r   )r,   r   rL   ry   rM   ry   r   r   rF   r%   rG   r3   rH   rx   r^   r   )r,   r   rL   ry   rM   ry   rF   r%   rG   r3   r^   r   )r,   r   rL   ry   rM   ry   r   ry   ro   r   rF   r%   rG   r3   rH   rx   r^   r   )r,   r   rL   ry   rM   ry   r   ry   rF   r%   rG   r3   rH   rx   r^   r   )r,   r   rG   r3   r^   ztuple[ModuleType, str])r,   r   rL   ry   rM   ry   rN   ry   rF   r%   rH   rx   r^   z tuple[type[Warning] | None, str])r   r   r   r   r   r.   staticmethodr+   rD   DeprecationWarningre   rp   FutureWarningr   r   r   r   r   r`   r   r   r    r!   r#   r#   "   s   **##	$  54  $*<($($($ ($
 ($ ($ (($ 
4($` "#*<6$6$6$ 6$ 	6$ 6$ 6$ 6$ (6$ 
46$|  $*7>E>E>E >E 	>E >E >E (>E 
>EJ  $


 

 
 
 

<  $*<0)0)0) 0) 	0)
 0) 0) 0) (0) 
0)p  $*< ? ? ?  ?
  ?  ?  ? ( ? 
 ?D$HL!
!
!
 !
 	!

 !
 (!
 
*!
r    r#   )!__doc__
__future__r   r   rT   argparser   r   	functoolsr   typesr   typingr   r	   r
   r   r   r   r   r   rA   r   r   r   r   r    r   RuntimeErrorr   r#   
deprecatedr   r    r!   <module>r      sx    ( " 
  %    2>>)A#AT&\:J 	l 	D
 D
N  ,
r    