Download python/Lib/site-packages/rich/_stack.py from codekingpro/portable-devtools: direct link, hf CLI and curl.
- Browser
- Download file 351 Bytes
-
https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/Lib/site-packages/rich/_stack.py
- Command line
-
hf download hf://datasets/codekingpro/portable-devtools@df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/Lib/site-packages/rich/_stack.py
-
curl -L -o _stack.py https://huggingface.co/datasets/codekingpro/portable-devtools/resolve/df58e70f9edde36aaca2d2aacc2440dd6c2f807d/python/Lib/site-packages/rich/_stack.py
351 Bytes
| from typing import List, TypeVar | |
| T = TypeVar("T") | |
| class Stack(List[T]): | |
| """A small shim over builtin list.""" | |
| 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) | |