From 5cf759d2e670eb4cb79d978491bf42ed0eff23a5 Mon Sep 17 00:00:00 2001 From: Ivan Shcheklein Date: Mon, 18 Mar 2024 07:40:19 -0700 Subject: [PATCH] fix(core): accept kwargs in get file (#863) Fixes https://github.com/iterative/dvc-s3/issues/80 --- s3fs/core.py | 2 +- s3fs/tests/test_s3fs.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/s3fs/core.py b/s3fs/core.py index 4e59997d..1777940d 100644 --- a/s3fs/core.py +++ b/s3fs/core.py @@ -1271,7 +1271,7 @@ async def _upload_chunk(chunk, part_number): return out async def _get_file( - self, rpath, lpath, callback=_DEFAULT_CALLBACK, version_id=None + self, rpath, lpath, callback=_DEFAULT_CALLBACK, version_id=None, **kwargs ): if os.path.isdir(lpath): return diff --git a/s3fs/tests/test_s3fs.py b/s3fs/tests/test_s3fs.py index ffbf3d3e..d3d90899 100644 --- a/s3fs/tests/test_s3fs.py +++ b/s3fs/tests/test_s3fs.py @@ -991,6 +991,15 @@ def test_get_file_with_callback(s3, tmpdir): assert cb.value == cb.size +def test_get_file_with_kwargs(s3, tmpdir): + test_file = str(tmpdir.join("test.json")) + + get_file_kwargs = {"max_concurency": 1, "random_kwarg": "value"} + s3.get_file( + test_bucket_name + "/test/accounts.1.json", test_file, **get_file_kwargs + ) + + @pytest.mark.parametrize("size", [2**10, 10 * 2**20]) def test_put_file_with_callback(s3, tmpdir, size): test_file = str(tmpdir.join("test.json"))