harbor run -t openthoughts/tasktrove-exp-rpt-issue-issue-0968harbor download openthoughts/tasktrove-exp-rpt-issue-issue-0968Self-contained task: Fix RangeSlider initialization so that user-supplied initial values (including identical min and max) are accepted and rendered without errors.
Problem description (clear, concise)
What you’ll implement (high level, no exact patch details)
Important: Do not reveal the exact patch in this task description. Describe the expected behavior instead and implement it in code.
Files to modify (in /app/)
Files to create/modify (2-5 relevant)
Hint on the relevant parts (shown for context only; do not copy-paste the fix here)
Before (pre-fix) code snippets to illustrate the issue
# lib/matplotlib/widgets.py (excerpt)
from .patches import Circle, Rectangle, Ellipse
# ... later in RangeSlider.__init__ ...
if orientation == "vertical":
# ... existing code ...
self.poly = ax.axhspan(valinit[0], valinit[1], 0, 1, **kwargs)
handleXY_1 = [.5, valinit[0]]
handleXY_2 = [.5, valinit[1]]
else:
# ... existing code ...
self.poly = ax.axvspan(valinit[0], valinit[1], 0, 1, **kwargs)
handleXY_1 = [valinit[0], .5]
handleXY_2 = [valinit[1], .5]
def set_val(self, val):
"""
Set slider value to *val*.
"""
val = np.sort(np.asanyarray(val))
if val.shape != (2,):
raise ValueError(f"val must have shape (2,) but has shape {val.shape}")
val[0] = self._min_in_bounds(val[0])
val[1] = self._max_in_bounds(val[1])
xy = self.poly.xy
if self.orientation == "vertical":
xy[0] = .25, val[0]
xy[1] = .25, val[1]
xy[2] = .75, val[1]
xy[3] = .75, val[0]
# xy[4] = .25, val[0]
else:
xy[0] = val[0], .25
xy[1] = val[0], .75
xy[2] = val[1], .75
xy[3] = val[1], .25
# xy[4] = val[0], .25
self.poly.xy = xy
self.valtext.set_text(self._format(val))
if self.drawon:
self.ax.figure.canvas.draw_idle()
self.val = val
if self.eventson:
self._observers.process("changed", val)
What the agent should do
Acceptance criteria
How to test (in /app/)
Note