mirror of https://github.com/explosion/spaCy.git
Resolve within working_dir context manager
This commit is contained in:
parent
72175b5c60
commit
8e20505970
|
@ -273,7 +273,7 @@ def project_init(
|
||||||
silent (bool): Don't print any output (via DVC).
|
silent (bool): Don't print any output (via DVC).
|
||||||
analytics (bool): Opt-in to DVC analytics (defaults to False).
|
analytics (bool): Opt-in to DVC analytics (defaults to False).
|
||||||
"""
|
"""
|
||||||
with working_dir(project_dir.resolve()) as cwd:
|
with working_dir(project_dir) as cwd:
|
||||||
if git:
|
if git:
|
||||||
run_command(["git", "init"])
|
run_command(["git", "init"])
|
||||||
init_cmd = ["dvc", "init"]
|
init_cmd = ["dvc", "init"]
|
||||||
|
|
|
@ -467,11 +467,12 @@ def working_dir(path: Union[str, Path]) -> None:
|
||||||
directory, to prevent mismatches with relative paths.
|
directory, to prevent mismatches with relative paths.
|
||||||
"""
|
"""
|
||||||
prev_cwd = Path.cwd()
|
prev_cwd = Path.cwd()
|
||||||
os.chdir(str(path))
|
current = Path(path).resolve()
|
||||||
|
os.chdir(str(current))
|
||||||
try:
|
try:
|
||||||
yield Path(path).resolve()
|
yield current
|
||||||
finally:
|
finally:
|
||||||
os.chdir(prev_cwd)
|
os.chdir(str(prev_cwd))
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
Loading…
Reference in New Issue