
    h                     <   S SK r S SKrS SKJr  S SKJrJrJrJrJ	r	  S SK
r
S SKJrJr  SSKJrJr  SSKJr  SS	KJrJrJrJr  SS
KJrJr  \R6                  " S5      \" SSS9\" SSSSS9\" SSSSSS9\" SSSSS9\" SSSSS94S\\   S\S\S \S!\4
S" jj5       r S/SS#SSS$.S\\   S\S\S \\\      S!\S%\	\\4   4S& jjjr S%\\\4   4S' jr!S#S(.S\S\S%\\\4   4S) jjr"S\S%\\   4S* jr#S\S%\\\4   4S+ jr$  S0S,\\\4   S-\\   S \\\      S%\4S. jjr%g)1    N)Path)AnyDictListOptionalUnion)MarkdownRendererPrinter   )aboututil)importlib_metadata   )ArgOptappstring_to_list)get_latest_versionget_model_filenameinfoz Optional loadable spaCy pipeline)helpFz
--markdownz-mdz#Generate Markdown for GitHub issuesz--silentz-sz-Sz"Don't print anything (just return)labelsz	--excludez-ez2Comma-separated keys to exclude from the print-outz--urlz-uzLPrint the URL to download the most recent compatible version of the pipelinemodelmarkdownsilentexcludeurlc                 4    [        U5      n[        U UUUUS9  g)aE  
Print info about spaCy installation. If a pipeline is specified as an argument,
print its meta information. Flag --markdown prints details in Markdown for easy
copy-pasting to GitHub issues.

Flag --url prints only the download URL of the most recent compatible
version of the pipeline.

DOCS: https://spacy.io/api/cli#info
r   r   r   r   N)r   r   )r   r   r   r   r   s        H/home/james-whalen/.local/lib/python3.13/site-packages/spacy/cli/info.pyinfo_clir!      s%    ( W%G    Tr   returnc                   [        X"(       + S9nU(       d  / nU(       a5  U b!  SU  S3n[        U 5      n[        US   5        U$ UR                  SSS9  O#U (       a  SU  S3n[	        XS	9nOS
n[        5       nWR                  5        VV	s0 s H&  u  pUR                  5       R                  SS5      U	_M(     n
nn	SU;   aD  [        US   [        5      (       a,  SR                  S US   R                  5        5       5      US'   [        UWUS9nU(       a  U(       d  [        U5        U$ U(       d:  UR                  5        VV	s0 s H  u  pX;  d  M  X_M     nnn	UR                  XS9  U
$ s  sn	nf s  sn	nf )Nno_printprettyzDownload info for pipeline ''download_urlz%--url option requires a pipeline namer   exitszInfo about pipeline 'r   zInfo about spaCy _	Pipelinesz, c              3   6   #    U  H  u  pU S U S3v   M     g7f)z ()N ).0nvs      r    	<genexpr>info.<locals>.<genexpr>H   s"      &
%>TQqcA3aL%>s   )titler   )r8   )r
   info_model_urlprintfail
info_model
info_spacyitemslowerreplace
isinstancedictjoinget_markdowntable)r   r   r   r   r   msgr8   datakr5   raw_datamarkdown_data
table_datas                r    r   r   -   si    6*
5C
25';E!%(D$~&'KHH<AHF	'wa0%/"|;?::<H<41	!!#s+Q.<HHdz${*;TBB II &
%)+%6%<%<%>&
 
[ !UGDM- '+zz|H|tqq7Gdad|
H		*	*O I Is   
-E-E3E3c                  ^   0 n [         R                  " 5        H-  nUR                  SS5      n[         R                  " U5      X'   M/     [        R
                  [        [        [        5      R                  R                  5      [        R                  " 5       [        R                  " 5       U S.$ )zTGenerate info about the current spaCy intallation.

RETURNS (dict): The spaCy info.
-r.   )zspaCy versionLocationPlatformzPython versionr/   )r   get_installed_modelsr@   get_package_versionr   __version__strr   __file__parentplatformpython_version)
all_modelspkg_namepackages      r    r=   r=   V   s    
 J--/""3,"66x@
 0 **X--445%%'"113 r"   r,   c                *   [        X(       + S9n[        R                  " U 5      (       a  [        R                  " U 5      nO[	        U 5      nUS-  nUR                  5       (       d  UR                  SUSS9  [        R                  " U5      nUR                  5       U:w  a  [        UR                  5       5      US'   O[        U5      US'   [        U 5      nU(       a  XeS'   UR                  5        VVs0 s H  u  pxUS;  d  M  Xx_M     snn$ s  snnf )	zGenerate info about a specific model.

model (str): Model name of path.
silent (bool): Don't print anything, just return.
RETURNS (dict): The model meta.
r%   z	meta.jsonzCan't find pipeline meta.jsonr   r*   sourcer)   )accuracyperformancespeed)r
   r   
is_packageget_package_pathr   is_filer;   srsly	read_jsonresolverS   info_installed_model_urlr>   )	r   r   rF   
model_path	meta_pathmetar)   rH   r5   s	            r    r<   r<   h   s     6*
5Cu**51
%[
[(I0)1E??9%Dz)Z//12XZX+E2L+^%2V)V  s   5DDc                      [         R                  " U 5      nUR                  S5      n[        U[        5      (       a  [
        R                  " U5      nUS   $  g! [         a     gf = f)zGiven a pipeline name, get the download URL if available, otherwise
return None.

This is only available for pipelines installed as modules that have
dist-info available.
zdirect_url.jsonr   N)r   distribution	read_textrA   rS   jsonloads	Exception)r   disttextrG   s       r    rf   rf      sl    !..u5~~/0dC  ::d#D; !
   s   AA 
A('A(c                     [        U 5      n[        X5      n[        R                  S-   U-   nSnUR	                  XS9nX5S.$ )z=Return the download URL for the latest version of a pipeline./z>https://github.com/explosion/spacy-models/releases/tag/{m}-{v})mr5   )r)   release_url)r   r   r   __download_url__format)r   versionfilenamer)   release_tplru   s         r    r9   r9      sL     'G!%1H))C/(:LRK$$u$8K(EEr"   rG   r8   c                    [        5       nU(       a!  UR                  UR                  SU5      5        / nU R                  5        Hs  u  pVU(       a  XR;   a  M  [	        U[
        5      (       a#   [        U5      R                  5       nU(       a  MK  UR                  UR                  U S35       SU 35        Mu     UR                  UR                  U5      5        SUR                   S3$ ! [         a    Sn Nsf = f)zGet data in GitHub-flavoured Markdown format for issues etc.

data (Dict[str, Any]): Label/value pairs.
title (str): Optional title, will be rendered as headline 2.
exclude (List[str]): Names of keys to exclude.
RETURNS (str): The Markdown string.
r   F:r-   
)r	   addr8   r>   rA   rS   r   existsro   appendboldlistrq   )rG   r8   r   mdr>   keyvalueexisting_paths           r    rD   rD      s     
	B
rxx5!"Ejjl
s~eS!!& $U 2 2 4 3%q	*+1UG45 # FF2775>y  & %&s   .C,,C;:C;)N)NN)&rm   rV   pathlibr   typingr   r   r   r   r   rc   wasabir	   r
    r   r   compatr   _utilr   r   r   r   downloadr   r   commandrS   boolr!   rB   r   r=   r<   rf   r9   rD   r2   r"   r    <module>r      s      3 3  ,  ' 0 0 < V t*LMe:_`uj$;_`xd9mnE7D/}~C=  	
  
 <  & #'&C=& & 	&
 d3i & 
& 39&RDcN $ .2 c d d38n 8C HSM $F# F$sCx. F  #'
sCx.C= d3i  		r"   