-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use status bar for retriever update #442
Conversation
progress = 1 | ||
status = "Done...\r\n" | ||
block = int(round(barWidth*progress)) | ||
text = "\r[{0}] {1:.2f}%".format("#"*block + "-"*(barWidth-block), |
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.
@ghoshbishakh great work. just a few things to change.
I think we can add Downlaod progress text = "\rDownload Progress: [{0}]
429904f
to
c25ff1b
Compare
def update_progressbar(progress): | ||
"""Shows progressbar given progress in float | ||
Example: 0.5 for 50% | ||
""" |
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.
In the doc string we can remove this Example:
0.5 for 50%
or we wan instead explain how this comes up
"""Shows progressbar given progress in float
accepts a a number between 0 and 1 and it's converted to a float.
a number under 0 represents a 'halt'.
a number at 1 or greater represents 100%
"""
@henrykironde thank you for taking a look. 😄 I am updating my PR. |
e048508
to
5cdf0be
Compare
@henrykironde I hope that is better |
pass | ||
status = "" | ||
if isinstance(progress, int): | ||
progress = float(progress) |
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 we change the logic and assume that given a number just convert to float, and this case we may not need to check if its int.
so before line 102, we can just say progress = float(progress)
good call 😄 will update. |
Modify this to change the length of the progress bar if we go with bar_length or barLenth , people reading the code later may understand easily since the comment is talking about length |
ok sure but actually I am dynamically setting the length of the progressbar later according to the console width. So I think its better to comment that as default bar width? |
ok that works |
|
||
def update_progressbar(progress): | ||
"""Shows progressbar given progress in float | ||
accepts a a number between 0 and 1 and it's converted to a float. |
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.
space after the first line
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.
sorry I did not get that
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.
ah in the docstring ok!
1e32126
to
c140fef
Compare
Did I miss anything? |
bar_length = 20 | ||
except: | ||
pass | ||
status = "" |
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.
if we are creating status
, then I guess we may include it in line text = "\rDownload Progress:....
or we can remove the creation of status
c140fef
to
a34f1ab
Compare
@henrykironde cat you take a look at it now? |
ok
|
Thanks for this @ghoshbishakh. Overall it looks great. I have a couple of thoughts/recommendations/questions:
|
@ethanwhite thanks for the suggestions 😄
|
Fixes weecology#397 Use a progress bar while scripts are being downloaded for retriever update Change progress bar text Change update_progressbar description
a34f1ab
to
aabe094
Compare
@ethanwhite I have pushed with the required changes |
great work @ghoshbishakh |
Use status bar for retriever update
@henrykironde thanks! 😄 |
Fixes #397
Use a progress bar while scripts are being downloaded for retriever update