
    Nvi\                        S SK Jr  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r	S SK
r
S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S SKJr  S S	KJr  S S
KJr  S SKJr  S SKJr  S SKJ r   S SK!J"r"  S SK#J$r$  S SK%J&r&  S SK'J(r(  S SK)J*r*J+r+  S SK,J-r-J.r.J/r/J0r0  S SK1J2r2J3r3J4r4  \Rj                  " SS9r6\Rn                  " \85      r9S S jr: " S S5      r;\ " S S5      5       r<S!S jr=      S"S jr>          S#S jr?S$S jr@g)%    )annotationsN)	dataclass)Callable)Version)parse)Group)escape)Text)LinkCollector)PackageFinder)get_default_environment)ReleaseControl)SelectionPreferences)
PipSession)WINDOWS)parse_iso_datetime) get_best_invocation_for_this_pip#get_best_invocation_for_this_python)adjacent_tmp_filecheck_path_ownercopy_directory_permissionsreplace)ExternallyManagedEnvironmentcheck_externally_managed
ensure_dir   )daysc                n    U R                  5       n[        R                  " U5      R                  5       nU$ N)encodehashlibsha224	hexdigest)key	key_bytesnames      ]/var/www/html/land-ocr/venv/lib/python3.13/site-packages/pip/_internal/self_outdated_check.py_get_statefile_namer(   1   s)    

I>>)$..0DK    c                  F    \ rS rSrSS jr\S	S j5       rS
S jrSS jrSr	g)SelfCheckState7   c                l   0 U l         S U l        U(       as  [        R                  R	                  US[        U R                  5      5      U l         [        U R                  SS9 n[        R                  " U5      U l         S S S 5        g g ! , (       d  f       g = f! [        [        [        4 a     g f = f)N	selfcheckzutf-8)encoding)_state_statefile_pathospathjoinr(   r$   openjsonloadOSError
ValueErrorKeyError)self	cache_dir	statefiles      r'   __init__SelfCheckState.__init__8   s    &(# #%77<<;(;DHH(E$D $..AY"&))I"6DK BA 
 BAZ2  s0   B $B
 B 

BB B B32B3c                "    [         R                  $ r   )sysprefix)r;   s    r'   r$   SelfCheckState.keyI   s    zzr)   c                    U R                   (       d  gSU R                   ;  a  gSU R                   ;  a  g[        U R                   S   5      nX-
  nU[        :  a  gU R                   S   $ )z7Check if we have a not-outdated version loaded already.N
last_checkpypi_version)r0   r   _WEEK)r;   current_timerE   time_since_last_checks       r'   getSelfCheckState.getM   sb    {{t{{*, (L(AB
 , 9 5({{>**r)   c                .   U R                   (       d  g [        R                  R                  U R                   5      n[	        U5      (       d  g [        U5        U R                  UR                  5       US.n[        R                  " USSS9n[        U R                   5       nUR                  UR                  5       5        [        X65        S S S 5         [        WR                  U R                   5        g ! , (       d  f       N0= f! [          a     g f = f)N)r$   rE   rF   T),:)	sort_keys
separators)r1   r2   r3   dirnamer   r   r$   	isoformatr6   dumpsr   writer    r   r   r&   r8   )r;   rF   rH   statefile_directorystatetextfs          r'   setSelfCheckState.set`   s    ## ggood.B.BC   344 	&'
 88&002(
 zz%4JGt334GGDKKM"&':> 5	 AFFD001 54  		s   !+C6 D 6
D
DD)r0   r1   N)r<   strreturnNone)r\   r[   )rH   datetime.datetimer\   
str | None)rF   r[   rH   r^   r\   r]   )
__name__
__module____qualname____firstlineno__r>   propertyr$   rJ   rY   __static_attributes__ r)   r'   r+   r+   7   s%    "  +&#r)   r+   c                  4    \ rS rSr% S\S'   S\S'   SS jrSrg)	UpgradePrompt   r[   oldnewc                   [         (       a  [        5        S3nO
[        5       nSn[        [	        5       [        R
                  " U SU R                   SU R                   S35      [        R
                  " U S[        U5       S35      5      $ )Nz -m pipz/[bold][[reset][blue]notice[reset][bold]][reset]z) A new release of pip is available: [red]z[reset] -> [green]z[reset]z To update, run: [green]z install --upgrade pip)	r   r   r   r   r
   from_markuprj   rk   r	   )r;   pip_cmdnotices      r'   __rich__UpgradePrompt.__rich__   s    7<>?wGG68GBF( z!3DHH:WF (  /**@B

 
	
r)   rf   N)r\   r   )r`   ra   rb   rc   __annotations__rp   re   rf   r)   r'   rh   rh      s    	H	H
r)   rh   c                h    [        5       R                  U 5      nUSL=(       a    SUR                  :H  $ )zChecks whether pkg was installed by pip

This is used not to display the upgrade message when pip is in fact
installed by system package manager, such as dnf on Fedora.
Npip)r   get_distribution	installer)pkgdists     r'   was_installed_by_pipry      s0     #$55c:Dt7 77r)   c                    [         R                  " U USS9n[        S[        S1S9S9n[        R                  " UUS9nUR                  S5      R                  nUc  g [        UR                  5      $ )NT)optionssuppress_no_indexFrt   )
only_final)allow_yankedrelease_control)link_collectorselection_prefs)	r   creater   r   r   find_best_candidatebest_candidater[   version)sessionr{   r   r   finderr   s         r'   _get_current_remote_pip_versionr      s     #))N +&5':O
 !!%'F //6EEN~%%&&r)   c                   U R                  U5      nUc1  U" 5       nUc  [        R                  S5        g U R                  XA5        [	        U5      n[        R                  SU5        [        R                  SU5        [        S5      n[        R                  SU5        U(       d  g X%:  =(       a    UR                  UR                  :g  nU(       a  [        [        U5      US9$ g )NzNo remote pip version foundzRemote version of pip: %szLocal version of pip:  %srt   zWas pip installed by pip? %s)rj   rk   )	rJ   loggerdebugrY   parse_versionry   base_versionrh   r[   )rV   rH   local_versionget_remote_versionremote_version_strremote_versionpip_installed_by_piplocal_version_is_olders           r'   _self_version_check_logicr      s     <0!/1%LL67		$3"#56N
LL,n=
LL,m</6
LL/1EF 	& 	F&&.*E*EE  ]!39KLLr)   c           
        [        5       R                  S5      nU(       d  g [        5         [	        [        UR                  S9[        R                  R                  [        R                  R                  5      UR                  [        R                  " [        X5      S9nUb  [        R!                  SUSS0S9  gg! [         a     gf = f)	zCheck for an update for pip.

Limit the frequency of checks to once per week. State is stored either in
the active virtualenv or in the user's USER_CACHE_DIR keyed off the prefix
of the pip script path.
rt   N)r<   )rV   rH   r   r   z%srichT)extra)r   ru   r   r   r   r+   r<   datetimenowtimezoneutcr   	functoolspartialr   r   warning)r   r{   installed_distupgrade_prompts       r'   pip_self_version_checkr      s     -.??FN " /w'8'89&&**8+<+<+@+@A$,,$,,+W
	N !t^FD>B " ( s   
B> >
C
C)r$   r[   r\   r[   )rw   r[   r\   bool)r   r   r{   optparse.Valuesr\   r_   )
rV   r+   rH   r^   r   r   r   zCallable[[], str | None]r\   zUpgradePrompt | None)r   r   r{   r   r\   r]   )A
__future__r   r   r   r!   r6   loggingoptparseos.pathr2   rA   dataclassesr   typingr   pip._vendor.packaging.versionr   r   r   pip._vendor.rich.consoler   pip._vendor.rich.markupr	   pip._vendor.rich.textr
   pip._internal.index.collectorr   "pip._internal.index.package_finderr   pip._internal.metadatar   $pip._internal.models.release_controlr   $pip._internal.models.selection_prefsr   pip._internal.network.sessionr   pip._internal.utils.compatr   pip._internal.utils.datetimer   pip._internal.utils.entrypointsr   r   pip._internal.utils.filesystemr   r   r   r   pip._internal.utils.miscr   r   r   	timedeltarG   	getLoggerr`   r   r(   r+   rh   ry   r   r   r   rf   r)   r'   <module>r      s   "        
 !  1 @ * * & 7 < : ? E 4 . ;   	"			8	$L L^ 
 
 
08''"1''8 $ 	
 1 DCr)   