Skip to content

Commit

Permalink
fix bisect call
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Mar 11, 2024
1 parent e11b195 commit 7db2f4d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
12 changes: 5 additions & 7 deletions src/textual/dom.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,11 @@ def __init_subclass__(
cls._merged_bindings = cls._merge_bindings()
cls._css_type_names = frozenset(css_type_names)
cls._computes = frozenset(
dict.fromkeys(
[
name.lstrip("_")[8:]
for name in dir(cls)
if name.startswith(("_compute_", "compute_"))
]
).keys()
[
name.lstrip("_")[8:]
for name in dir(cls)
if name.startswith(("_compute_", "compute_"))
]
)

def get_component_styles(self, name: str) -> RenderStyles:
Expand Down
4 changes: 2 additions & 2 deletions src/textual/eta.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def _prune(self) -> None:
# Keep at least 10 samples
return
prune_time = self._samples[-1][0] - self.estimation_period
index = bisect.bisect_left(self._samples, prune_time)
index = bisect.bisect_left(self._samples, (prune_time, 0))
del self._samples[:index]

def _get_progress_at(self, time: float) -> tuple[float, float]:
"""Get the progress at a specific time."""
index = bisect.bisect_left(self._samples, time)
index = bisect.bisect_left(self._samples, (time, 0))
if index >= len(self._samples):
return self.last_sample
if index == 0:
Expand Down

0 comments on commit 7db2f4d

Please sign in to comment.