Skip to content

Commit 6faa4d0

Browse files
committed
a couple cacheutils typing improvementS
1 parent 14904da commit 6faa4d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

boltons/cacheutils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -742,12 +742,12 @@ def add(self, key: _KT) -> None:
742742
self._cur_bucket += 1
743743
return
744744

745-
def elements(self) -> itertools.chain[_T]:
745+
def elements(self) -> itertools.chain[_KT]:
746746
"""Return an iterator of all the common elements tracked by the
747747
counter. Yields each key as many times as it has been seen.
748748
"""
749749
repeaters = itertools.starmap(itertools.repeat, self.iteritems())
750-
return itertools.chain.from_iterable(repeaters)
750+
return itertools.chain.from_iterable(repeaters) # type: ignore
751751

752752
def most_common(self, n: int | None = None) -> list[tuple[_KT, int]]:
753753
"""Get the top *n* keys and counts as tuples. If *n* is omitted,
@@ -821,7 +821,7 @@ def get(self, key: _KT, default: int = 0) -> int:
821821
except KeyError:
822822
return default
823823

824-
def update(self, iterable: Iterable[_KT] | Mapping[_KT, int], **kwargs: Iterable[_KT] | Mapping[_KT, int]) -> None:
824+
def update(self, iterable: Iterable[_KT] | Mapping[_KT, int], **kwargs: Mapping[_KT, int]) -> None:
825825
"""Like dict.update() but add counts instead of replacing them, used
826826
to add multiple items in one call.
827827

0 commit comments

Comments
 (0)