You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When initializing an EnhancedTextProgressBar object the __init__ method is calling the start method of it's super class instead of it's own. When then using update (without calling start manually again) there will be an AttributeError because width is not getting initialized by __init__
Code to Reproduce the Bug
from qutip.ui.progressbar import *
n = 10
a = EnhancedTextProgressBar(n)
# a.start(n)foriin range(n):
a.update(i)
a.finished()
Code Output
Traceback (most recent call last):
File "C:\Users\Name\Desktop\qutip_bug.py", line 6, in<module>
a.update(i)
File "C:\Users\Name\AppData\Local\Programs\Python\Python311\Lib\site-packages\qutip\ui\progressbar.py", line 96, in update
all_full = self.width - 2
^^^^^^^^^^
AttributeError: 'EnhancedTextProgressBar' object has no attribute 'width'
Expected Behaviour
Proper initialization of the width attribute by EnhancedTextProgressBar.__init__
I would suggest making them both call their own start method to omit an additional call of start by the user right after initialization. This would also make both classes be in line with the usage suggested by the docstring of BaseProgressBar. Otherwise I would suggest to include the call to start in said docstring.
As I'm pretty new to github and git in general I would like to try and create a PR myself once you give me approval for the suggested change here.
The text was updated successfully, but these errors were encountered:
Bug Description
When initializing an
EnhancedTextProgressBar
object the__init__
method is calling thestart
method of it's super class instead of it's own. When then usingupdate
(without callingstart
manually again) there will be anAttributeError
becausewidth
is not getting initialized by__init__
Code to Reproduce the Bug
Code Output
Expected Behaviour
Proper initialization of the
width
attribute byEnhancedTextProgressBar.__init__
Your Environment
Additional Context
Currently in master the
__init__
for bothTextProgressBar
andEnhancedTextProgressBar
have been commented out and made to just pass. Seequtip/qutip/ui/progressbar.py
Line 66 in af49884
qutip/qutip/ui/progressbar.py
Line 94 in af49884
I would suggest making them both call their own
start
method to omit an additional call of start by the user right after initialization. This would also make both classes be in line with the usage suggested by the docstring ofBaseProgressBar.
Otherwise I would suggest to include the call to start in said docstring.As I'm pretty new to github and git in general I would like to try and create a PR myself once you give me approval for the suggested change here.
The text was updated successfully, but these errors were encountered: