Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
abc.py
Go to the documentation of this file.
1
from
abc
import
ABC
2
3
4
class
RichRenderable
(ABC):
5
"""An abstract base class for Rich renderables.
6
7
Note that there is no need to extend this class, the intended use is to check if an
8
object supports the Rich renderable protocol. For example::
9
10
if isinstance(my_object, RichRenderable):
11
console.print(my_object)
12
13
"""
14
15
@classmethod
16
def
__subclasshook__
(cls, other: type) -> bool:
17
"""Check if this class supports the rich render protocol."""
18
return
hasattr
(other,
"__rich_console__"
)
or
hasattr
(other,
"__rich__"
)
19
20
21
if
__name__ ==
"__main__"
:
# pragma: no cover
22
from
pip._vendor.rich.text
import
Text
23
24
t =
Text
()
25
print(
isinstance
(Text, RichRenderable))
26
print(
isinstance
(t, RichRenderable))
27
28
class
Foo
:
29
pass
30
31
f = Foo()
32
print(
isinstance
(f, RichRenderable))
33
print(
isinstance
(
""
, RichRenderable))
pip._vendor.rich.abc.Foo
Definition
abc.py:28
pip._vendor.rich.abc.RichRenderable
Definition
abc.py:4
pip._vendor.rich.abc.RichRenderable.__subclasshook__
bool __subclasshook__(cls, type other)
Definition
abc.py:16
pip._vendor.rich.text.Text
Definition
text.py:101
pip._vendor.rich.text
Definition
text.py:1
i
for i
Definition
prime_search.m:10
venv
lib
python3.12
site-packages
pip
_vendor
rich
abc.py
Generated by
1.9.8