B Anð]‰ ã@s~ddlmZddlZddlmZddlmZddlmZm Z ddl m Z ej dd de fd d de fd d d efdddd„ƒZdS)é)Úunicode_literalsN)ÚPath)ÚPrinteré)Ú symlink_toÚpath2str)Úutilz#package name or local path to modelÚ positionalzname of shortuct link to createz"force overwriting of existing linkÚflagÚf)ÚoriginÚ link_nameÚforceFc Cs\tƒ}t |¡rt |¡}n|dkr,t|ƒnt|ƒ}| ¡sV|jdd t|ƒ¡ddt  ¡}|rj| ¡sŽtt ƒj j }|jddj|dddt  ¡|}|  ¡r¾|s¾|jd  |¡d ddn0|  ¡rÐ|  ¡n| ¡rî|jd  |¡d ddd t|ƒt|ƒf}yt||ƒWn*| d |¡d¡| |¡‚YnX| d|¡| d |¡¡dS)zå Create a symlink for models within the spacy/data directory. Accepts either the name of a pip package, or the local path to the model data directory. Linking models allows loading them via spacy.load(link_name). NzCan't locate model dataz The data should be located in {}é)Úexitsz6Can't find the spaCy data path to create model symlinkz}Make sure a directory `/data` exists within your spaCy installation and try again. The data directory should be located here:)ÚpathzLink '{}' already existsz3To overwrite an existing link, use the --force flagzCan't overwrite symlink '{}'zUThis can happen if your data directory contains a directory or file of the same name.z %s --> %szCouldn't link model to '{}'zùCreating a symlink in spacy/data failed. Make sure you have the required permissions and try re-running the command as admin, or use a virtualenv. You can still import the model as a module and call its load() method, or create the symlink manually.zLinking successfulz/You can now load the model via spacy.load('{}'))rrÚ is_packageÚget_package_pathrÚexistsÚfailÚformatrZ get_data_pathÚ__file__ÚparentÚ is_symlinkÚunlinkrÚtextÚgood) r r rÚ model_pathÚmsgZ data_pathZ spacy_locZ link_pathÚdetails©r úq/home/app_decipher_dev_19-4/dev/decipher-analysis/serverless-application/helper/df_spacy/python/spacy/cli/link.pyÚlink sR            r")FN)Ú __future__rÚplacÚpathlibrÚwasabirÚcompatrrÚrÚ annotationsÚstrÚboolr"r r r r!Ús