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

Data Structures

class  Capture
 
class  CaptureError
 
class  Console
 
class  ConsoleDimensions
 
class  ConsoleOptions
 
class  ConsoleRenderable
 
class  ConsoleThreadLocals
 
class  Group
 
class  NewLine
 
class  NoChange
 
class  PagerContext
 
class  RenderHook
 
class  RichCast
 
class  ScreenContext
 
class  ScreenUpdate
 
class  ThemeContext
 

Functions

Callable[..., Callable[..., Group]] group (bool fit=True)
 
bool _is_jupyter ()
 
"WindowsConsoleFeatures" get_windows_console_features ()
 
bool detect_legacy_windows ()
 
str _svg_hash (str svg_main_code)
 

Variables

int JUPYTER_DEFAULT_COLUMNS = 115
 
int JUPYTER_DEFAULT_LINES = 100
 
str WINDOWS = "Windows"
 
 HighlighterType = Callable[[Union[str, "Text"]], "Text"]
 
 JustifyMethod = Literal["default", "left", "center", "right", "full"]
 
 OverflowMethod = Literal["fold", "crop", "ellipsis", "ignore"]
 
 NO_CHANGE = NoChange()
 
 _STDIN_FILENO = sys.__stdin__.fileno()
 
 _STDOUT_FILENO = sys.__stdout__.fileno()
 
 _STDERR_FILENO = sys.__stderr__.fileno()
 
tuple _STD_STREAMS = (_STDIN_FILENO, _STDOUT_FILENO, _STDERR_FILENO)
 
tuple _STD_STREAMS_OUTPUT = (_STDOUT_FILENO, _STDERR_FILENO)
 
dict _TERM_COLORS
 
 RenderableType = Union[ConsoleRenderable, RichCast, str]
 
 RenderResult = Iterable[Union[RenderableType, Segment]]
 
 _null_highlighter = NullHighlighter()
 
dict COLOR_SYSTEMS
 
dict _COLOR_SYSTEMS_NAMES = {system: name for name, system in COLOR_SYSTEMS.items()}
 
 console = Console(record=True)
 

Function Documentation

◆ _is_jupyter()

bool _is_jupyter ( )
protected
Check if we're running in a Jupyter notebook.

Definition at line 517 of file console.py.

517def _is_jupyter() -> bool: # pragma: no cover
518 """Check if we're running in a Jupyter notebook."""
519 try:
520 get_ipython # type: ignore[name-defined]
521 except NameError:
522 return False
523 ipython = get_ipython() # type: ignore[name-defined]
525 if (
526 "google.colab" in str(ipython.__class__)
527 or os.getenv("DATABRICKS_RUNTIME_VERSION")
528 or shell == "ZMQInteractiveShell"
529 ):
530 return True # Jupyter notebook or qtconsole
531 elif shell == "TerminalInteractiveShell":
532 return False # Terminal running IPython
533 else:
534 return False # Other type (?)
535
536
for i

References i.

◆ _svg_hash()

str _svg_hash ( str  svg_main_code)
protected
Returns a unique hash for the given SVG main code.

Args:
    svg_main_code (str): The content we're going to inject in the SVG envelope.

Returns:
    str: a hash of the given content

Definition at line 2568 of file console.py.

2568def _svg_hash(svg_main_code: str) -> str:
2569 """Returns a unique hash for the given SVG main code.
2570
2571 Args:
2572 svg_main_code (str): The content we're going to inject in the SVG envelope.
2573
2574 Returns:
2575 str: a hash of the given content
2576 """
2577 return str(zlib.adler32(svg_main_code.encode()))
2578
2579

References i.

◆ detect_legacy_windows()

bool detect_legacy_windows ( )
Detect legacy Windows.

Definition at line 588 of file console.py.

588def detect_legacy_windows() -> bool:
589 """Detect legacy Windows."""
590 return WINDOWS and not get_windows_console_features().vt
591
592

References pip._vendor.rich.console.get_windows_console_features().

Here is the call graph for this function:

◆ get_windows_console_features()

"WindowsConsoleFeatures" get_windows_console_features ( )

Definition at line 578 of file console.py.

578def get_windows_console_features() -> "WindowsConsoleFeatures": # pragma: no cover
579 global _windows_console_features
580 if _windows_console_features is not None:
581 return _windows_console_features
582 from ._windows import get_windows_console_features
583
584 _windows_console_features = get_windows_console_features()
585 return _windows_console_features
586
587

References pip._vendor.rich.console.get_windows_console_features().

Referenced by Console._detect_color_system(), pip._vendor.rich.console.detect_legacy_windows(), and pip._vendor.rich.console.get_windows_console_features().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ group()

Callable[..., Callable[..., Group]] group ( bool   fit = True)
A decorator that turns an iterable of renderables in to a group.

Args:
    fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.

Definition at line 495 of file console.py.

495def group(fit: bool = True) -> Callable[..., Callable[..., Group]]:
496 """A decorator that turns an iterable of renderables in to a group.
497
498 Args:
499 fit (bool, optional): Fit dimension of group to contents, or fill available space. Defaults to True.
500 """
501
502 def decorator(
503 method: Callable[..., Iterable[RenderableType]]
504 ) -> Callable[..., Group]:
505 """Convert a method that returns an iterable of renderables in to a Group."""
506
507 @wraps(method)
508 def _replace(*args: Any, **kwargs: Any) -> Group:
509 renderables = method(*args, **kwargs)
510 return Group(*renderables, fit=fit)
511
512 return _replace
513
514 return decorator
515
516

Variable Documentation

◆ _COLOR_SYSTEMS_NAMES

dict _COLOR_SYSTEMS_NAMES = {system: name for name, system in COLOR_SYSTEMS.items()}
protected

Definition at line 544 of file console.py.

◆ _null_highlighter

_null_highlighter = NullHighlighter()
protected

Definition at line 285 of file console.py.

◆ _STD_STREAMS

tuple _STD_STREAMS = (_STDIN_FILENO, _STDOUT_FILENO, _STDERR_FILENO)
protected

Definition at line 105 of file console.py.

◆ _STD_STREAMS_OUTPUT

tuple _STD_STREAMS_OUTPUT = (_STDOUT_FILENO, _STDERR_FILENO)
protected

Definition at line 106 of file console.py.

◆ _STDERR_FILENO

int _STDERR_FILENO = sys.__stderr__.fileno()
protected

Definition at line 101 of file console.py.

◆ _STDIN_FILENO

int _STDIN_FILENO = sys.__stdin__.fileno()
protected

Definition at line 93 of file console.py.

◆ _STDOUT_FILENO

int _STDOUT_FILENO = sys.__stdout__.fileno()
protected

Definition at line 97 of file console.py.

◆ _TERM_COLORS

dict _TERM_COLORS
protected
Initial value:
1= {
3 "256color": ColorSystem.EIGHT_BIT,
4 "16color": ColorSystem.STANDARD,
5}

Definition at line 109 of file console.py.

◆ COLOR_SYSTEMS

dict COLOR_SYSTEMS
Initial value:
1= {
2 "standard": ColorSystem.STANDARD,
4 "truecolor": ColorSystem.TRUECOLOR,
5 "windows": ColorSystem.WINDOWS,
6}

Definition at line 537 of file console.py.

◆ console

console = Console(record=True)

Definition at line 2581 of file console.py.

◆ HighlighterType

HighlighterType = Callable[[Union[str, "Text"]], "Text"]

Definition at line 81 of file console.py.

◆ JUPYTER_DEFAULT_COLUMNS

int JUPYTER_DEFAULT_COLUMNS = 115

Definition at line 77 of file console.py.

◆ JUPYTER_DEFAULT_LINES

int JUPYTER_DEFAULT_LINES = 100

Definition at line 78 of file console.py.

◆ JustifyMethod

JustifyMethod = Literal["default", "left", "center", "right", "full"]

Definition at line 82 of file console.py.

◆ NO_CHANGE

NO_CHANGE = NoChange()

Definition at line 90 of file console.py.

◆ OverflowMethod

OverflowMethod = Literal["fold", "crop", "ellipsis", "ignore"]

Definition at line 83 of file console.py.

◆ RenderableType

RenderableType = Union[ConsoleRenderable, RichCast, str]

Definition at line 280 of file console.py.

◆ RenderResult

RenderResult = Iterable[Union[RenderableType, Segment]]

Definition at line 283 of file console.py.

◆ WINDOWS

str WINDOWS = "Windows"

Definition at line 79 of file console.py.