mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-11 17:56:30 +03:00
Return data in cli.info and add silent option (resolves #2196)
This commit is contained in:
parent
1c6d77610c
commit
3c80f69ff5
|
@ -13,8 +13,9 @@ from .. import about
|
|||
|
||||
@plac.annotations(
|
||||
model=("optional: shortcut link of model", "positional", None, str),
|
||||
markdown=("generate Markdown for GitHub issues", "flag", "md", str))
|
||||
def info(model=None, markdown=False):
|
||||
markdown=("generate Markdown for GitHub issues", "flag", "md", str),
|
||||
silent=("don't print anything (just return)", "flag", "s"))
|
||||
def info(model=None, markdown=False, silent=False):
|
||||
"""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.
|
||||
|
@ -33,14 +34,17 @@ def info(model=None, markdown=False):
|
|||
meta['source'] = path2str(model_path.resolve())
|
||||
else:
|
||||
meta['source'] = path2str(model_path)
|
||||
print_info(meta, 'model %s' % model, markdown)
|
||||
else:
|
||||
data = {'spaCy version': about.__version__,
|
||||
'Location': path2str(Path(__file__).parent.parent),
|
||||
'Platform': platform.platform(),
|
||||
'Python version': platform.python_version(),
|
||||
'Models': list_models()}
|
||||
if not silent:
|
||||
print_info(meta, 'model %s' % model, markdown)
|
||||
return meta
|
||||
data = {'spaCy version': about.__version__,
|
||||
'Location': path2str(Path(__file__).parent.parent),
|
||||
'Platform': platform.platform(),
|
||||
'Python version': platform.python_version(),
|
||||
'Models': list_models()}
|
||||
if not silent:
|
||||
print_info(data, 'spaCy', markdown)
|
||||
return data
|
||||
|
||||
|
||||
def print_info(data, title, markdown):
|
||||
|
|
Loading…
Reference in New Issue
Block a user