
    )i!                       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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,J-r-  S SK.J/r/J0r0J1r1  \Rd                  " SS9r3\Rh                  " \55      r6SS jr7S S jr8 " S S5      r9\ " S S5      5       r:S!S jr;      S"S jr<          S#S jr=S$S jr>g)%    )annotationsN)	dataclass)AnyCallable)Version)parse)Group)escape)Text)LinkCollector)PackageFinder)get_default_environment)SelectionPreferences)
PipSession)WINDOWS) 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      a/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/pip/_internal/self_outdated_check.py_get_statefile_namer'   /   s)    

I>>)$..0DK    c                `    [         R                   R                  U R                  SS5      5      $ )zConvert an ISO format string to a date.

Handles the format 2020-01-22T14:24:01Z (trailing Z)
which is not supported by older versions of fromisoformat.
Zz+00:00)datetimefromisoformatr   )isodates    r&   _convert_dater.   5   s&     **7??3+IJJr(   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)SelfCheckState>   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__?   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.keyP   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)r5   r.   _WEEK)r@   current_timerJ   time_since_last_checks       r&   getSelfCheckState.getT   sb    {{t{{*, #4;;|#<=
 , 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#   rJ   rK   T),:)	sort_keys
separators)r6   r7   r8   dirnamer   r   r#   	isoformatr;   dumpsr   writer   r   r   r%   r=   )r@   rK   rM   statefile_directorystatetextfs          r&   setSelfCheckState.setg   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)r5   r6   N)rA   strreturnNone)ra   r`   )rM   datetime.datetimera   
str | None)rK   r`   rM   rc   ra   rb   )
__name__
__module____qualname____firstlineno__rC   propertyr#   rO   r^   __static_attributes__ r(   r&   r0   r0   >   s%    "  +&#r(   r0   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_markupro   rp   r
   )r@   pip_cmdnotices      r&   __rich__UpgradePrompt.__rich__   s    7<>?wGG68GBF( z!3DHH:WF (  /**@B

 
	
r(   rk   N)ra   r	   )re   rf   rg   rh   __annotations__ru   rj   rk   r(   r&   rm   rm      s    	H	H
r(   rm   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_pipr~      s0     #$55c:Dt7 77r(   c                    [         R                  " U USS9n[        SS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_indexF)allow_yankedallow_all_prereleases)link_collectorselection_prefsry   )r   creater   r   find_best_candidatebest_candidater`   version)sessionr   r   r   finderr   s         r&   _get_current_remote_pip_versionr      sy     #))N +#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:  %sry   zWas pip installed by pip? %s)ro   rp   )	rO   loggerdebugr^   parse_versionr~   base_versionrm   r`   )r[   rM   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.
ry   N)rA   )r[   rM   r   r   z%srichT)extra)r   rz   r   r   r   r0   rA   r+   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`   ra   r`   )r-   r`   ra   rc   )r|   r`   ra   bool)r   r   r   optparse.Valuesra   rd   )
r[   r0   rM   rc   r   r   r   zCallable[[], str | None]ra   zUpgradePrompt | None)r   r   r   r   ra   rb   )?
__future__r   r+   r   r    r;   loggingoptparseos.pathr7   rF   dataclassesr   typingr   r   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.selection_prefsr   pip._internal.network.sessionr   pip._internal.utils.compatr   pip._internal.utils.entrypointsr   r   pip._internal.utils.filesystemr   r   r   r   pip._internal.utils.miscr   r   r   	timedeltarL   	getLoggerre   r   r'   r.   r0   rm   r~   r   r   r   rk   r(   r&   <module>r      s   "        
 !   1 @ * * & 7 < : E 4 .   	"			8	$KL L^ 
 
 
08''"1''8 $ 	
 1 DCr(   