U C^O @sddlmZddlZddlZddlmZddlmZddlZddl m Z m Z m Z ddl mZddl mZejd d defd d d efdddddZddZdddZdS))unicode_literalsN)Path)msg)path2str basestring_unicode_)util)aboutzOptional shortcut link of model positionalz#Generate Markdown for GitHub issuesflagZmd)z"Don't print anything (just return)r s)modelmarkdownsilentFc Cs"|rt|rt|}n t|}|d}|sFtjd|ddt|}| |krzt ||d<t | |d<n t ||d<|sd |}dd | D}|rt ||d ntj||d |Stjt ttjjtttd }|sd }|rt ||d ntj||d |S) z Print info about spaCy installation. If a model shortcut link is speficied as an argument, print model information. Flag --markdown prints details in Markdown for easy copy-pasting to GitHub issues. z meta.jsonzCan't find model meta.json)ZexitslinksourcezInfo about model '{}'cSsi|]\}}|dkr||qS))Zaccuracyspeed).0kvrr1/tmp/pip-install-6_kvzl1k/spacy/spacy/cli/info.py *szinfo..)title)z spaCy versionLocationPlatformzPython versionZModelszInfo about spaCy)r is_packageZget_package_path get_data_pathis_filerfailsrsly read_jsonresolverformatitemsprint_markdowntabler __version__r__file__parentplatformpython_version list_models) rrrZ model_path meta_pathmetarZ model_metadatarrrinfosB         r2csBddt}|r>dd|D}dfdd|DSdS)NcSsd}||kp|dS)N)cachepycache __pycache__.) startswith)Zdir_nameexcluderrr exclude_dirCsz list_models..exclude_dircSsg|]}|r|jdqS))is_dirparts)rfrrr Jszlist_models..z, csg|]}|s|qSrr)rmr9rrr>Ks-)r riterdirjoin)Z data_pathmodelsrr@rr.Bs r.cCsng}|D]6\}}t|tr,t|r,q |d|t|q |rVtd|tdd |dS)zPrint data in GitHub-flavoured Markdown format for issues etc. data (dict or list of tuples): Label/value pairs. title (unicode or None): Title, will be rendered as headline 2. z * **{}:** {}z ## {}z {}  N) r& isinstancerrexistsappendr%rprintrC)r1rrkeyvaluerrrr'Osr')NFF)N) __future__rZplacr,pathlibrZwasabirr"compatrrrr r annotationsstrr2r.r'rrrrs        .