-
Notifications
You must be signed in to change notification settings - Fork 47
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
Turn off adaptive step if "step" option is given #425
Conversation
Codecov Report
@@ Coverage Diff @@
## main #425 +/- ##
==========================================
+ Coverage 88.94% 88.99% +0.05%
==========================================
Files 30 30
Lines 3926 3935 +9
==========================================
+ Hits 3492 3502 +10
+ Misses 434 433 -1
Continue to review full report at Codecov.
|
@@ -29,8 +29,7 @@ def __init__( | |||
self, | |||
min: Union[float, _Unset] = UNSET, | |||
max: Union[float, _Unset] = UNSET, | |||
step: float = 1, | |||
adaptive_step: bool = True, | |||
step: Union[float, _Unset, None] = UNSET, |
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.
Could you motivate me to why you add None
and _Unset
here? One of them should be enough.
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.
That's because min and max are also initialized with UNSET... I guess UNSET is for value
only (because it might be set to None intentionally) so should we just change the defaults of min, max and step to None?
I apologize for missing backward compatibility in my PR. |
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.
Thank you @hanjinliu
This PR changes the default behavior of
step
andadaptive_step
.I like the idea of using adaptive step by default but it should be turned off if
step
is explicitly given (also in terms of backward compatibility).It is not straightforward that the
step
option is ignored unless"adaptive_step": False
is specified at the same time.To do this, I corresponded
step=None
to adaptive step mode, and accordingly, the default value ofstep
is changed from1
toUNSET
andstep
returnsNone
if the widget is in adaptive step mode.This change might violate compatibility if one checks the value like
widget.step == 1
but it seems very rare.