mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-07 13:44:55 +03:00
Use ensure_pathy for upload/download
This commit is contained in:
parent
4b64c1bbcc
commit
1c2aae6117
|
@ -337,6 +337,8 @@ def upload_file(src: Path, dest: Union[str, Path, "CloudPath"]) -> None:
|
||||||
src (Path): The source path.
|
src (Path): The source path.
|
||||||
url (str): The destination URL to upload to.
|
url (str): The destination URL to upload to.
|
||||||
"""
|
"""
|
||||||
|
dest = ensure_pathy(dest)
|
||||||
|
|
||||||
# Create parent directories for local paths
|
# Create parent directories for local paths
|
||||||
if isinstance(dest, Path):
|
if isinstance(dest, Path):
|
||||||
if not dest.parent.exists():
|
if not dest.parent.exists():
|
||||||
|
@ -357,6 +359,8 @@ def download_file(
|
||||||
force (bool): Whether to force download even if file exists.
|
force (bool): Whether to force download even if file exists.
|
||||||
If False, the download will be skipped.
|
If False, the download will be skipped.
|
||||||
"""
|
"""
|
||||||
|
src = ensure_pathy(src)
|
||||||
|
|
||||||
if dest.exists() and not force:
|
if dest.exists() and not force:
|
||||||
return None
|
return None
|
||||||
with src.open(mode="rb") as input_file:
|
with src.open(mode="rb") as input_file:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user