mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-10 19:57:17 +03:00
Save one line of code
This commit is contained in:
parent
02247cccaf
commit
f758804401
|
@ -1065,8 +1065,7 @@ def import_file(name: str, loc: Union[str, Path]) -> ModuleType:
|
||||||
loc (str / Path): Path to the file.
|
loc (str / Path): Path to the file.
|
||||||
RETURNS: The loaded module.
|
RETURNS: The loaded module.
|
||||||
"""
|
"""
|
||||||
loc = str(loc)
|
spec = importlib.util.spec_from_file_location(name, str(loc))
|
||||||
spec = importlib.util.spec_from_file_location(name, loc)
|
|
||||||
module = importlib.util.module_from_spec(spec)
|
module = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(module)
|
spec.loader.exec_module(module)
|
||||||
return module
|
return module
|
||||||
|
|
Loading…
Reference in New Issue
Block a user