Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.rich.protocol Namespace Reference

Functions

bool is_renderable (Any check_object)
 
"RenderableType" rich_cast (object renderable)
 

Variables

str _GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
 

Function Documentation

◆ is_renderable()

bool is_renderable ( Any  check_object)
Check if an object may be rendered by Rich.

Definition at line 10 of file protocol.py.

10def is_renderable(check_object: Any) -> bool:
11 """Check if an object may be rendered by Rich."""
12 return (
13 isinstance(check_object, str)
14 or hasattr(check_object, "__rich__")
15 or hasattr(check_object, "__rich_console__")
16 )
17
18
for i

References i.

◆ rich_cast()

"RenderableType" rich_cast ( object  renderable)
Cast an object to a renderable by calling __rich__ if present.

Args:
    renderable (object): A potentially renderable object

Returns:
    object: The result of recursively calling __rich__.

Definition at line 19 of file protocol.py.

19def rich_cast(renderable: object) -> "RenderableType":
20 """Cast an object to a renderable by calling __rich__ if present.
21
22 Args:
23 renderable (object): A potentially renderable object
24
25 Returns:
26 object: The result of recursively calling __rich__.
27 """
28 from pip._vendor.rich.console import RenderableType
29
30 rich_visited_set: Set[type] = set() # Prevent potential infinite loop
31 while hasattr(renderable, "__rich__") and not isclass(renderable):
32 # Detect object which claim to have all the attributes
33 if hasattr(renderable, _GIBBERISH):
34 return repr(renderable)
35 cast_method = getattr(renderable, "__rich__")
36 renderable = cast_method()
37 renderable_type = type(renderable)
38 if renderable_type in rich_visited_set:
39 break
40 rich_visited_set.add(renderable_type)
41
42 return cast(RenderableType, renderable)

References i.

Variable Documentation

◆ _GIBBERISH

str _GIBBERISH = """aihwerij235234ljsdnp34ksodfipwoe234234jlskjdf"""
protected

Definition at line 7 of file protocol.py.