
    q"h^$                        % S SK r S SKrS SKrS SK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JrJrJrJrJrJrJr  S SKJrJr  \R0                  " \5      r\" SSS9r\" S	S
SS9rSq\\   \S'   \	S\S   4S j5       r " S S5      r Sq!\\    \S'   \	S\\ SS4   4S j5       r" " S S5      r#\#" 5       r$ " S S5      r% " S S\%5      r&g)    N)	ExitStackcontextmanager)Path)AnyCallableDict	GeneratorListOptionalTypeVarUnion)enumrmtree_TTempDirectory)boundz	build-envzephem-wheel-cachez	req-build)	BUILD_ENVEPHEM_WHEEL_CACHE	REQ_BUILD_tempdir_managerreturn)NNNc               #      #    [        5        n [        U snq S v   Uq S S S 5        g ! Uqf = f! , (       d  f       g = f7fN)r   r   )stackold_tempdir_managers     N/var/www/html/env/lib/python3.13/site-packages/pip/_internal/utils/temp_dir.pyglobal_tempdir_managerr   '   sB      
0@%--	32 

  3 
s'   A 
/(/	A ,/
=A c                   J    \ rS rSrSrSS jrS\S\SS4S jrS\S\4S	 jr	S
r
g)TempDirectoryTypeRegistry2   zManages temp directory behaviorr   Nc                     0 U l         g r   _should_deleteselfs    r   __init__"TempDirectoryTypeRegistry.__init__5   s
    /1    kindvaluec                      X R                   U'   g)zKIndicate whether a TempDirectory of the given kind should be
auto-deleted.
Nr"   )r%   r)   r*   s      r   
set_delete$TempDirectoryTypeRegistry.set_delete8   s     %*D!r(   c                 :    U R                   R                  US5      $ )zNGet configured auto-delete flag for a given TempDirectory type,
default True.
T)r#   get)r%   r)   s     r   
get_delete$TempDirectoryTypeRegistry.get_delete>   s     ""&&tT22r(   r"   r   N)__name__
__module____qualname____firstlineno____doc__r&   strboolr,   r0   __static_attributes__ r(   r   r   r   2   s7    )2*s *4 *D *3s 3t 3r(   r   _tempdir_registryc               #   P   #    [         n [        5       q  [         v   U q g! U q f = f7f)zmProvides a scoped global tempdir registry that can be used to dictate
whether directories should be deleted.
N)r<   r   )old_tempdir_registrys    r   tempdir_registryr?   H   s.      -13100s   & &#&c                       \ rS rSrSrg)_DefaultV   r;   N)r3   r4   r5   r6   r:   r;   r(   r   rA   rA   V   s    r(   rA   c                      ^  \ rS rSrSrS\SSS4S\\   S\\	S\
4   S	\S
\	S\	4
U 4S jjjr\S\4S j5       rS\4S jrS\S\4S jrS\S\S\SS4S jrS	\S\4S jrSS jrSrU =r$ )r   ]   a  Helper class that owns and cleans up a temporary directory.

This class can be used as a context manager or as an OO representation of a
temporary directory.

Attributes:
    path
        Location to the created temporary directory
    delete
        Whether the directory should be deleted when exiting
        (when used as a contextmanager)

Methods:
    cleanup()
        Deletes the temporary directory

When used as a context manager, if the delete attribute is True, on
exiting the context the temporary directory is deleted.
NtempFTpathdeleter)   globally_managedignore_cleanup_errorsc                    > [         TU ]  5         U[        L a  Ub  SnOS nUc  U R                  U5      nXl        SU l        X l        X0l        XPl        U(       a  [        c   e[        R                  U 5        g g )NF)superr&   _default_create_path_deletedrG   r)   rI   r   enter_context)r%   rF   rG   r)   rH   rI   	__class__s         r   r&   TempDirectory.__init__r   s     	X   <<<%D
	%:"#///**40 r(   r   c                 d    U R                   (       a   SU R                   35       eU R                  $ )Nz"Attempted to access deleted path: )rO   rN   r$   s    r   rF   TempDirectory.path   s*    ==S$Ftzzl"SS zzr(   c                 R    SU R                   R                   SU R                  < S3$ )N< >)rQ   r3   rF   r$   s    r   __repr__TempDirectory.__repr__   s&    4>>**+1TYYM;;r(   r%   c                     U $ r   r;   r$   s    r   	__enter__TempDirectory.__enter__   s    r(   excr*   tbc                     U R                   b  U R                   nO-[        (       a   [        R                  U R                  5      nOSnU(       a  U R	                  5         g g )NT)rG   r<   r0   r)   cleanup)r%   r^   r*   r_   rG   s        r   __exit__TempDirectory.__exit__   sE    ;;"[[F&11$))<FFLLN r(   c                     [         R                  R                  [        R                  " SU S3S95      n[
        R                  SU5        U$ )z<Create a temporary directory and store its path in self.pathpip--prefixCreated temporary directory: %s)osrF   realpathtempfilemkdtemploggerdebug)r%   r)   rF   s      r   rM   TempDirectory._create   s?     ww 0 0$tfA GH6=r(   c                   ^ SU l         [        R                  R                  U R                  5      (       d  g/ mS[
        S[        4   S[        S[        SS4U4S jjnU R                  (       a>   [        U R                  S	S
9  T(       a!  [        R                  SU R                  5        gg[        U R                  5        g! [         a    [        U R                  US9   N_f = f)z6Remove the temporary directory created and reset stateTNfunc.rF   exc_valr   c                 ~  > SR                  [        R                  " [        U5      U5      5      nUR	                  5       nU [
        R                  [
        R                  [
        R                  4;   a  [        R                  SUU5        O![        R                  SU R                  U5        TR                  U5        g)z/Log a warning for a `rmtree` error and continue
z2Failed to remove a temporary file '%s' due to %s.
z%s failed with %s.N)join	tracebackformat_exception_onlytyperstriprj   unlinkremovermdirrn   ro   r5   append)rr   rF   rs   formatted_excerrorss       r   onerror&TempDirectory.cleanup.<locals>.onerror   s     !II//WwGM *002M		299bhh77I! 143D3DmTMM'"r(   F)ignore_errors)onexcz[Failed to remove contents in a temporary directory '%s'.
You can safely remove it manually.)rO   rj   rF   existsrN   r   r   r   BaseExceptionrI   r   OSErrorrn   warning)r%   r   r   s     @r   ra   TempDirectory.cleanup   s    ww~~djj))&(	#38$	#	# #	# 		#( %%2tzz7 9JJ  4::  2tzz12s   1C C%$C%)rO   rN   rG   rI   r)   r2   )r3   r4   r5   r6   r7   rL   r   r8   r   r9   rA   r&   propertyrF   rY   r   r\   r   rb   rM   ra   r:   __classcell__rQ   s   @r   r   r   ]   s    , #.6!&&*!1sm!1 dD(*+!1 	!1
 !1  $!1 !1F c  <# < r 	C 	 	 	 	C C * *r(   c                      ^  \ rS rSrSrSrSS\S\\   SS4U 4S jjjr	\
S	\S\\SS4   4S
 j5       rS\S\4S jrSrU =r$ )AdjacentTempDirectory   a  Helper class that creates a temporary directory adjacent to a real one.

Attributes:
    original
        The original directory to create a temp directory for.
    path
        After calling create() or entering, contains the full
        path to the temporary directory.
    delete
        Whether the directory should be deleted when exiting
        (when used as a contextmanager)

z-~.=%0123456789NoriginalrG   r   c                 L   > UR                  S5      U l        [        TU ]  US9  g )Nz/\)rG   )rz   r   rK   r&   )r%   r   rG   rQ   s      r   r&   AdjacentTempDirectory.__init__   s#     .'r(   namec              #     #    [        S[        U5      5       HR  n[        R                  " U R                  US-
  5       H'  nSSR                  U5      -   XS -   nXA:w  d  M#  Uv   M)     MT     [        [        U R                  5      5       HM  n[        R                  " U R                  U5       H%  nSSR                  U5      -   U-   nXA:w  d  M!  Uv   M'     MO     g7f)zGenerates a series of temporary names.

The algorithm replaces the leading characters in the name
with ones that are valid filesystem characters, but are not
valid package names (for both Python and pip definitions of
package).
   ~ N)rangelen	itertoolscombinations_with_replacementLEADING_CHARSrv   )clsr   i	candidatenew_names        r   _generate_names%AdjacentTempDirectory._generate_names   s      q#d)$A&DD!!1q5	 !33d2h>#"N % s3,,-.A&DD!!1	 !33d:#"N /s   AC"A+CCr)   c                 :   [         R                  R                  U R                  5      u  p#U R	                  U5       HX  n[         R                  R                  X$5      n [         R                  " U5        [         R                  R                  U5      n  O7   [         R                  R                  [        R                  " SU S3S95      n[        R                  SU5        U$ ! [         a*  nUR                  [        R                  :w  a  e  S nAM  S nAff = f)Nre   rf   rg   ri   )rj   rF   splitr   r   rv   mkdirrk   r   errnoEEXISTrl   rm   rn   ro   )r%   r)   rootr   r   rF   exs          r   rM   AdjacentTempDirectory._create  s    WW]]4==1
--d3I77<<0D ww''- 4 77##H$4$4d4&N$KLD6=  88u||+ ,s    C&&
D0DD)r   r   )r3   r4   r5   r6   r7   r   r8   r   r9   r&   classmethodr	   r   rM   r:   r   r   s   @r   r   r      sw    & &M( (htn ( ( ( #3 #9S$_+E # #2C C  r(   r   )'r   r   loggingos.pathrj   rl   rw   
contextlibr   r   pathlibr   typingr   r   r   r	   r
   r   r   r   pip._internal.utils.miscr   r   	getLoggerr3   rn   r   tempdir_kindsr   __annotations__r   r   r<   r?   rA   rL   r   r   r;   r(   r   <module>r      s         0 	 	 	 2			8	$T)
 ) )- (9% , 3	*: ; 3 33 3& :> 856 = 
1)$=tT$IJ 
1 
1	 	 :B BJFM Fr(   