Spaces:
Sleeping
Sleeping
Download venv/lib/python3.14/site-packages/rich/abc.py from HSR-DeepThink/Perhance: direct link, hf CLI and curl.
- Browser
- Download file 878 Bytes
-
https://huggingface.co/spaces/HSR-DeepThink/Perhance/resolve/main/venv/lib/python3.14/site-packages/rich/abc.py
- Command line
-
hf download hf://spaces/HSR-DeepThink/Perhance/venv/lib/python3.14/site-packages/rich/abc.py
-
curl -L -o abc.py https://huggingface.co/spaces/HSR-DeepThink/Perhance/resolve/main/venv/lib/python3.14/site-packages/rich/abc.py
878 Bytes
| from abc import ABC | |
| class RichRenderable(ABC): | |
| """An abstract base class for Rich renderables. | |
| Note that there is no need to extend this class, the intended use is to check if an | |
| object supports the Rich renderable protocol. For example:: | |
| if isinstance(my_object, RichRenderable): | |
| console.print(my_object) | |
| """ | |
| def __subclasshook__(cls, other: type) -> bool: | |
| """Check if this class supports the rich render protocol.""" | |
| return hasattr(other, "__rich_console__") or hasattr(other, "__rich__") | |
| if __name__ == "__main__": # pragma: no cover | |
| from rich.text import Text | |
| t = Text() | |
| print(isinstance(Text, RichRenderable)) | |
| print(isinstance(t, RichRenderable)) | |
| class Foo: | |
| pass | |
| f = Foo() | |
| print(isinstance(f, RichRenderable)) | |
| print(isinstance("", RichRenderable)) | |