mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
Update asset logic
This commit is contained in:
parent
ed46951842
commit
d6aa4cb478
|
@ -174,10 +174,10 @@ def fetch_asset(
|
||||||
project_path: Path, url: str, dest: Path, checksum: Optional[str] = None
|
project_path: Path, url: str, dest: Path, checksum: Optional[str] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
check_asset(url)
|
check_asset(url)
|
||||||
dest_path = project_path / dest
|
dest_path = (project_path / dest).resolve()
|
||||||
if dest_path.exists() and checksum:
|
if dest_path.exists() and checksum:
|
||||||
# If there's already a file, check for checksum
|
# If there's already a file, check for checksum
|
||||||
# TODO: add support for chaches
|
# TODO: add support for caches
|
||||||
if checksum == get_checksum(dest_path):
|
if checksum == get_checksum(dest_path):
|
||||||
msg.good(f"Skipping download with matching checksum: {dest}")
|
msg.good(f"Skipping download with matching checksum: {dest}")
|
||||||
return
|
return
|
||||||
|
@ -188,9 +188,8 @@ def fetch_asset(
|
||||||
out = subprocess.check_output(dvc_cmd, stderr=subprocess.DEVNULL)
|
out = subprocess.check_output(dvc_cmd, stderr=subprocess.DEVNULL)
|
||||||
print(out)
|
print(out)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
# TODO: Can we read out Weak ETags error?
|
|
||||||
# TODO: replace curl
|
# TODO: replace curl
|
||||||
run_command(["curl", url, "--output", str(dest_path)])
|
run_command(["curl", url, "--output", str(dest_path), "--progress-bar"])
|
||||||
run_command(["dvc", "add", str(dest_path)])
|
run_command(["dvc", "add", str(dest_path)])
|
||||||
msg.good(f"Fetched asset {dest}")
|
msg.good(f"Fetched asset {dest}")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user