diff options
Diffstat (limited to 'src/pip/_vendor/rich/_stack.py')
| -rw-r--r-- | src/pip/_vendor/rich/_stack.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/pip/_vendor/rich/_stack.py b/src/pip/_vendor/rich/_stack.py new file mode 100644 index 000000000..194564e76 --- /dev/null +++ b/src/pip/_vendor/rich/_stack.py @@ -0,0 +1,16 @@ +from typing import List, TypeVar + +T = TypeVar("T") + + +class Stack(List[T]): + """A small shim over builtin list.""" + + @property + def top(self) -> T: + """Get top of stack.""" + return self[-1] + + def push(self, item: T) -> None: + """Push an item on to the stack (append in stack nomenclature).""" + self.append(item) |
