
    h                         S SK r S SKrS SKJr  S SKJ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  SS	KJr  \R*                  " S
5      S 5       rSS jrSS\S\\\4   4S jjrS\S\4S jrg)    N)Path)Tuple)Printermsg   )about)get_installed_modelsget_minor_versionget_model_metaget_package_pathget_package_versionis_compatible_version   )appvalidatec                      [        5         g)z
Validate the currently installed pipeline packages and spaCy version. Checks
if the installed packages are compatible and shows upgrade instructions if
available. Should be run after `pip install -U spacy`.

DOCS: https://spacy.io/api/cli#validate
N)r        L/home/james-whalen/.local/lib/python3.13/site-packages/spacy/cli/validate.pyvalidate_clir      s	     Jr   returnc            
         [        5       u  p[        [        R                  5      nUR	                  U0 5      nU(       d  [
        R                  " SU S35        U R                  5        VVs1 s H  u  pEUS   (       a  M  US   iM     nnnU Vs/ s H  owU;  d  M
  UPM     nnU Vs/ s H  owU;   d  M
  UPM     n	n[        [        5      R                  R                  n
[
        R                  " S[        R                   S35        [
        R                  " SU
 35        U (       a  Sn/ nU R                  5        H  u  pUS   (       a1  [
        R                  " S	S
SSS9n[
        R                  " US   S
SS9nO5[
        R                  " US   SSS9nSUR	                  US   S/5      S    3nUR                  US   US   UU45        M     [
        R                  " XS9  O[
        R                  " SSS9  U	(       ak  [
        R                  " S5        [
        R                  " S5        Sn[!        SR#                  U	 Vs/ s H  nUR%                  U5      PM     sn5      S-   5        U(       a8  [
        R                  " S[        R                   S3SR#                  U5      5        U(       a  [&        R(                  " S5        g g s  snnf s  snf s  snf s  snf ) Nz"No compatible packages found for vz	 of spaCycompatnamez$Installed pipeline packages (spaCy v)zspaCy installation: )NAMESPACYVERSION r   greengoodT)coloriconno_printversion)r"   r$   yellowz--> n/ar   spacy)headerz7No pipeline packages found in your current environment.exitszInstall updatesz2Use the following commands to update the packages:zpython -m spacy download {}
zNThe following packages are custom spaCy pipelines or not available for spaCy v:z, r   )get_model_pkgsr
   r   __version__getr   warnitemsr   __file__parentdividerinfotextappendtableprintjoinformatsysexit)
model_pkgsr   spacy_versioncurrent_compat_dincompat_modelsm	na_modelsupdate_models	spacy_dirr)   rowsr   datacompr%   cmdpkgs                      r   r   r   !   s^   ')J%e&7&78MZZr2N5m_INO-7-=-=-?S-?TQq{yqy-?OS+GOq/FOIG /G13FQMGX%%,,IKK6u7H7H6IKLHH#I;/01$**,JDH~xx'N((4	?'DQ((4	?(TRn00fwGJKLKKftG}gtDE - 			$&JRST%&EF+diiMBMSCMBCdJK$$)$5$5#6a9IIi 	

  C TGG0 Cs*   ,K 	K	KK)	K6KKsilentc                    [        X (       + S9nUR                  " S5         [        R                  " [        R
                  5      nUR                  S:w  a   UR                  " SUR                   S3SSS9  S S S 5        UR                  " S	5        WR                  5       S
   n[        5       n[        R                  " 5          [        R                  " SSS9  [        5       nS S S 5        [        U5      R!                  5        H^  u  pgUR#                  UR%                  5       5        UR!                  5        H&  u  pU	 V
s/ s H  n
['        U
5      PM     sn
X6   U'   M(     M`     0 nW H  nUR)                  SS5      n[+        U5      nX;   a  XU   ;   n[        R,                  nOu[/        U5      n[        R                  " 5          [        R                  " SSS9  [1        U5      nS S S 5        WR                  SS5      n[3        [        R,                  U5      nUUUUS.X'   M     X4$ ! , (       d  f       GN= f! , (       d  f       GNb= fs  sn
f ! , (       d  f       Ns= f)N)r$   prettyzLoading compatibility table...   zServer error (r   z#Couldn't fetch compatibility table.r   r*   zLoaded compatibility tabler(   ignorez	\[W09[45])message-rB   r@   r'   )r   r%   r(   r   )r   loadingrequestsr0   r   __compatibility__status_codefailr!   jsonsetwarningscatch_warningsfilterwarningsr	   dictr2   updatekeysreformat_versionreplacer   r/   r   r   r   )rN   r   rr   
all_modelsinstalled_modelsspacy_vmodelsmodelmodel_vsvpkgspkg_namepackager%   	is_compatr@   
model_path
model_metas                      r   r.   r.   L   s   
6*
5C	5	6LL001==CHH q15 
7 HH)*VVXgFJ		 	 	",?/1 
#  <--/&++-(%||~OECK%L8a&6q&98%LFOE"  . 0 D$""3,%h/'?2I!--M)'2J((*'',G+J7
 + 'NN?EBM-e.?.?OI"	
 %& <M 
7	6 
#	" &M +*s*   AH+ H= I!I+
H:=
I
I"	r%   c                 v    U R                  S5      (       a  U R                  SS5      $ U R                  SS5      $ )zEHack to reformat old versions ending on '-alpha' to match pip format.z-alphaa0a)endswithrc   )r%   s    r   rb   rb   w   s5    !!x..??8S))r   )r   N)F)r=   r\   pathlibr   typingr   rV   wasabir   r   r   r   utilr	   r
   r   r   r   r   _utilr   commandr   r   boolr_   r.   strrb   r   r   r   <module>r~      s|    
         Z (V(4 (E$*,= (V*c *c *r   