-
Notifications
You must be signed in to change notification settings - Fork 306
prevent duration = 0.0 and divding by zero #284
Conversation
LGTM |
How about showing |
Hello again, Hakuyume-san,
|
@sitifukujin I think using small value for duration is not a good solution because it shows nonsense speed. How about showing 'inf KB/s' when the duration is zero. User can know that the speed can't be computed now. |
chainercv/utils/download.py
Outdated
progress_size = int(count * block_size) | ||
speed = int(progress_size / (1024 * duration)) | ||
if duration > 1e-4: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using try
and except
to catch ZeroDivisionError
. I think this is better because we can remove a magic value 1e-4
.
@Hakuyume
|
@sitifukujin Yes. I think this output is better. I added a comment. Please check it. |
Please check it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks, Yuyu-san and Hakuyume-san. See you. |
It is small bug. On my windows, it occurs dividing zero 100%. It might occur on linux.