Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/rich/_stack.py: 89%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from typing import List, TypeVar
3T = TypeVar("T")
6class Stack(List[T]):
7 """A small shim over builtin list."""
9 @property
10 def top(self) -> T:
11 """Get top of stack."""
12 return self[-1]
14 def push(self, item: T) -> None:
15 """Push an item on to the stack (append in stack nomenclature)."""
16 self.append(item)