Skip to content

Commit

Permalink
put_file: default to overwrite=True (#419)
Browse files Browse the repository at this point in the history
* put_file: default to overwrite=True

* changelog: document _put_file(overwrite=True) behavior change

* update tests
  • Loading branch information
pmrowla authored Jan 5, 2024
1 parent 32132c4 commit 488fdf0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Unreleased
----------

- Handle mixed casing for `hdi_isfolder` metadata when determining whether a blob should be treated as a folder.
- `_put_file`: `overwrite` now defaults to `True`.

2023.10.0
---------
Expand Down
7 changes: 4 additions & 3 deletions adlfs/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1548,18 +1548,19 @@ async def _put_file(
lpath,
rpath,
delimiter="/",
overwrite=False,
overwrite=True,
callback=None,
max_concurrency=None,
**kwargws,
**kwargs,
):
"""
Copy single file to remote
:param lpath: Path to local file
:param rpath: Path to remote file
:param delimitier: Filepath delimiter
:param overwrite: Boolean (False). If True, overwrite the existing file present
:param overwrite: Boolean (True). Whether to overwrite any existing file
(True) or raise if one already exists (False).
"""

container_name, path, _ = self.split_path(rpath, delimiter=delimiter)
Expand Down
2 changes: 1 addition & 1 deletion adlfs/tests/test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1854,7 +1854,7 @@ async def test_put_file_timeout(storage, mocker, tmp_path):
upload_blob.assert_called_once_with(
mocker.ANY,
metadata={"is_directory": "false"},
overwrite=False,
overwrite=True,
raw_response_hook=None,
max_concurrency=fs.max_concurrency,
timeout=11,
Expand Down

0 comments on commit 488fdf0

Please sign in to comment.