|
5 | 5 | from abc import ABCMeta, abstractmethod
|
6 | 6 | from typing import (
|
7 | 7 | TYPE_CHECKING,
|
8 |
| - Any, |
9 | 8 | Callable,
|
10 | 9 | Dict,
|
| 10 | + Hashable, |
11 | 11 | Iterable,
|
12 | 12 | List,
|
13 | 13 | NamedTuple,
|
@@ -175,7 +175,7 @@ def __init__(self,
|
175 | 175 | self.show_cursor = show_cursor
|
176 | 176 |
|
177 | 177 | # Cache for line heights. Maps cache key -> height
|
178 |
| - self._line_heights_cache: Dict[Any, int] = {} |
| 178 | + self._line_heights_cache: Dict[Hashable, int] = {} |
179 | 179 |
|
180 | 180 | def __getitem__(self, lineno: int) -> StyleAndTextTuples:
|
181 | 181 | " Make it iterable (iterate line by line). "
|
@@ -317,7 +317,7 @@ def __init__(
|
317 | 317 | self.get_cursor_position = get_cursor_position
|
318 | 318 |
|
319 | 319 | #: Cache for the content.
|
320 |
| - self._content_cache: SimpleCache[Any, UIContent] = SimpleCache(maxsize=18) |
| 320 | + self._content_cache: SimpleCache[Hashable, UIContent] = SimpleCache(maxsize=18) |
321 | 321 | self._fragment_cache: SimpleCache[int, StyleAndTextTuples] = SimpleCache(maxsize=1)
|
322 | 322 | # Only cache one fragment list. We don't need the previous item.
|
323 | 323 |
|
@@ -533,7 +533,7 @@ def __init__(
|
533 | 533 | #: Often, due to cursor movement, undo/redo and window resizing
|
534 | 534 | #: operations, it happens that a short time, the same document has to be
|
535 | 535 | #: lexed. This is a fairly easy way to cache such an expensive operation.
|
536 |
| - self._fragment_cache: SimpleCache[Any, Callable[[int], StyleAndTextTuples]] = \ |
| 536 | + self._fragment_cache: SimpleCache[Hashable, Callable[[int], StyleAndTextTuples]] = \ |
537 | 537 | SimpleCache(maxsize=8)
|
538 | 538 |
|
539 | 539 | self._last_click_timestamp: Optional[float] = None
|
|
0 commit comments