in otava/series.py [0:0]
def get_stable_range(self, metric: str, index: int) -> (int, int):
"""
Returns a range of indexes (A, B) such that:
- A is the nearest change point index of the `metric` before or equal given `index`,
or 0 if not found
- B is the nearest change point index of the `metric` after given `index,
or len(self.time) if not found
It follows that there are no change points between A and B.
"""
begin = 0
for cp in self.change_points[metric]:
if cp.index > index:
break
begin = cp.index
end = len(self.time())
for cp in reversed(self.change_points[metric]):
if cp.index <= index:
break
end = cp.index
return begin, end