-
Notifications
You must be signed in to change notification settings - Fork 767
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
Tweak progress bar docs. #3286
Tweak progress bar docs. #3286
Conversation
There is no good reason as to why the progress bar can't be set back to its indeterminate state (and you could actually do it with code) so this removes the docstring that says that a progress bar can't go back to its indeterminate state. Related issue: #3268 Related Discord message: https://discord.com/channels/1026214085173461072/1033754296224841768/1149742624002023594
7c027f5
to
e061f73
Compare
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.
You can also set the total with the update
, and it look like that prohibits setting None.
It's not that it prohibits. It's the only way to design such an |
I can get rid of the method |
To comply with #3286 (review) we create a new type around a sentinel object and check whether we're using the sentinel before modifying the progress bar reactives. Things that didn't quite work well: - directly checking 'if parameter is not _sentinel:' won't satisfy type checkers because that condition doesn't restrict the type of 'parameter' to _not_ be 'UnsetParameter'. - checking 'isinstance(parameter, float)' isn't enough because the user may call the method with an integer like '3' and then the isinstance check would fail. - checking 'isinstance(parameter, (int, float))' works but looks a bit odd, plus it is not very general.
There is no good reason as to why the progress bar can't be set back to its indeterminate state (and you could actually do it with code) so this removes the docstring that says that a progress bar can't go back to its indeterminate state.
Related issue: #3268
Related Discord message: https://discord.com/channels/1026214085173461072/1033754296224841768/1149742624002023594
The user in the linked Discord message reports that
pb.update(total=None)
“didn't change the [total] value so it doesn't work” but that's howupdate
works:pb.update(progress=None)
does nothing; andpb.update(advance=None)
also does nothing.The method
update
can only affect changes for keyword arguments that are set to a value other thanNone
.Setting
pb.total = None
works (it already worked) and the docstring fortotal
no longer says otherwise.I also added a test to make sure that setting
total
back toNone
works, so now this is explicitly a supported feature.