Move resolve_load_name to deprecated

This commit is contained in:
ines 2017-05-13 21:21:47 +02:00
parent 0095d5322b
commit 824d09bb74
3 changed files with 12 additions and 11 deletions

View File

@ -6,11 +6,12 @@ import importlib
from .compat import basestring_
from .cli.info import info
from .glossary import explain
from .deprecated import resolve_load_name
from . import util
def load(name, **overrides):
name = util.resolve_load_name(name, **overrides)
name = resolve_load_name(name, **overrides)
model_path = util.resolve_model_path(name)
meta = util.parse_package_meta(model_path)
if 'lang' not in meta:

View File

@ -21,3 +21,13 @@ def depr_model_download(lang):
"Downloading default '%s' model now..." % lang,
title="Warning: deprecated command")
download(lang)
def resolve_load_name(name, **overrides):
if overrides.get('path') not in (None, False, True):
name = overrides.get('path')
prints("To load a model from a path, you can now use the first argument. "
"The model meta is used to load the required Language class.",
"OLD: spacy.load('en', path='/some/path')", "NEW: spacy.load('/some/path')",
title="Warning: deprecated argument 'path'")
return name

View File

@ -55,16 +55,6 @@ def ensure_path(path):
return path
def resolve_load_name(name, **overrides):
if overrides.get('path') not in (None, False, True):
name = overrides.get('path')
prints("To load a model from a path, you can now use the first argument. "
"The model meta is used to load the required Language class.",
"OLD: spacy.load('en', path='/some/path')", "NEW: spacy.load('/some/path')",
title="Warning: deprecated argument 'path'")
return name
def resolve_model_path(name):
data_path = get_data_path()
if not data_path or not data_path.exists():