Skip to content

Commit 8780d7e

Browse files
committed
Fix formatting of MB/s
1 parent 85df47a commit 8780d7e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

frameioclient/lib/transfer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ def _download_whole(self, url: str):
305305
math.ceil(self.downloader.filesize / (download_time))
306306
)
307307
print(
308-
f"Downloaded {Utils.format_value(self.downloader.filesize, type=FormatTypes.SIZE)} at {download_speed}"
308+
f"Downloaded {Utils.format_value(self.downloader.filesize, type=FormatTypes.SIZE)} at {Utils.format_value(download_speed, type=FormatTypes.SPEED)}"
309309
)
310310

311311
return self.destination, download_speed
@@ -431,7 +431,7 @@ def multi_thread_download(self):
431431

432432
# Log completion event
433433
SDKLogger("downloads").info(
434-
f"Downloaded {Utils.format_value(self.downloader.filesize, type=FormatTypes.SIZE)} at {download_speed}"
434+
f"Downloaded {Utils.format_value(self.downloader.filesize, type=FormatTypes.SIZE)} at {Utils.format_value(download_speed, type=FormatTypes.SPEED)}"
435435
)
436436

437437
# Submit telemetry

tests/py2_integration.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pprint import pprint, pformat
1212
from datetime import datetime
1313
from frameioclient import FrameioClient, Utils, KB, MB
14+
from frameioclient.lib.utils import FormatTypes
1415

1516
token = os.getenv("FRAMEIO_TOKEN") # Your Frame.io token
1617
project_id = os.getenv("PROJECT_ID") # Project you want to upload files back into
@@ -109,7 +110,7 @@ def test_download(client, override=False):
109110
client.assets.download(asset, download_dir, multi_part=True)
110111

111112
download_time = time.time() - start_time
112-
download_speed = Utils.format_value(ceil(asset['filesize']/(download_time)))
113+
download_speed = Utils.format_value(ceil(asset['filesize']/(download_time)), type=FormatTypes.SPEED)
113114

114115
print("{}/{} Download completed in {:.2f}s @ {}".format((count), len(asset_list), download_time, download_speed))
115116

tests/py3_integration.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pprint import pprint, pformat
1212
from datetime import datetime
1313
from frameioclient import FrameioClient, Utils, KB, MB
14+
from frameioclient.lib.utils import FormatTypes
1415

1516
token = os.getenv("FRAMEIO_TOKEN") # Your Frame.io token
1617
project_id = os.getenv("PROJECT_ID") # Project you want to upload files back into
@@ -109,7 +110,7 @@ def test_download(client: FrameioClient, override=False):
109110
client.assets.download(asset, download_dir, multi_part=True)
110111

111112
download_time = time.time() - start_time
112-
download_speed = Utils.format_value(ceil(asset['filesize']/(download_time)))
113+
download_speed = Utils.format_value(ceil(asset['filesize']/(download_time)), type=FormatTypes.SPEED)
113114

114115
print("{}/{} Download completed in {:.2f}s @ {}".format((count), len(asset_list), download_time, download_speed))
115116

@@ -153,7 +154,7 @@ def test_upload(client: FrameioClient):
153154
client.assets.upload(new_parent_id, ul_abs_path)
154155

155156
upload_time = time.time() - start_time
156-
upload_speed = Utils.format_value(ceil(filesize/(upload_time)))
157+
upload_speed = Utils.format_value(ceil(filesize/(upload_time)), type=FormatTypes.SPEED)
157158

158159
print("{}/{} Upload completed in {:.2f}s @ {}".format((count), len(dled_files), upload_time, upload_speed))
159160

0 commit comments

Comments
 (0)