forked from Elwinmage/ha-reefbeat-component
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
shape (xs sorted ascending): to reach an index where x1 == x0, you’d need
x>x0 (so you didn’t match the previous point) and x≤x1 (so you match this
point), but if x0=x1 that can’t happen.
ha-reefbeat-component/custom_components/redsea/reefbeat/led.py
Lines 43 to 46 in 6f61046
| # TODO: That branch is mathematically unreachable for the supported input | |
| # shape (xs sorted ascending): to reach an index where x1 == x0, you’d need | |
| # x>x0 (so you didn’t match the previous point) and x≤x1 (so you match this | |
| # point), but if x0=x1 that can’t happen. |
x1 = xs[i]
y0 = ys[i - 1]
y1 = ys[i]
# TODO: That branch is mathematically unreachable for the supported input
# shape (xs sorted ascending): to reach an index where x1 == x0, you’d need
# x>x0 (so you didn’t match the previous point) and x≤x1 (so you match this
# point), but if x0=x1 that can’t happen.
if x1 == x0:
return y0 # pragma: no cover
t = (x - x0) / (x1 - x0)
return y0 + t * (y1 - y0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels