Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Commit 8918de1

Browse files
authored
fix: Let ByteSizeParamType to accept the default value given as int (#169)
1 parent 5480412 commit 8918de1

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

changes/169.fix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix regression of `vfolder upload` and other commands using `ByteSizeParamType` with the default values given as `int`

src/ai/backend/client/cli/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class ByteSizeParamType(click.ParamType):
2020
}
2121

2222
def convert(self, value, param, ctx):
23+
if isinstance(value, int):
24+
return value
2325
if not isinstance(value, str):
2426
self.fail(f"expected string, got {value!r} of type {type(value).__name__}", param, ctx)
2527
m = self._rx_digits.search(value)
@@ -34,6 +36,8 @@ class ByteSizeParamCheckType(ByteSizeParamType):
3436
name = "byte-check"
3537

3638
def convert(self, value, param, ctx):
39+
if isinstance(value, int):
40+
return value
3741
if not isinstance(value, str):
3842
self.fail(f"expected string, got {value!r} of type {type(value).__name__}", param, ctx)
3943
m = self._rx_digits.search(value)

src/ai/backend/client/func/vfolder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ async def upload(
248248
input_file = open(base_path / file_path, "rb")
249249
else:
250250
input_file = open(str(Path(file_path).relative_to(base_path)), "rb")
251-
print(f"Uploading {base_path / file_path} ...")
251+
print(f"Uploading {base_path / file_path} via {upload_info['url']} ...")
252252
# TODO: refactor out the progress bar
253253
uploader = tus_client.async_uploader(
254254
file_stream=input_file,

0 commit comments

Comments
 (0)