/opt/support/venv/lib/python3.13/site-packages/pip/_vendor/rich
NameSizeModeActions
__pycache__/-0755rm
abc.py8900755editdlrm
align.py103240755editdlrm
ansi.py69210755editdlrm
bar.py32630755editdlrm
box.py106860755editdlrm
cells.py51300755editdlrm
color.py182110755editdlrm
color_triplet.py10540755editdlrm
columns.py71310755editdlrm
console.py1008490755editdlrm
constrain.py12880755editdlrm
containers.py55020755editdlrm
control.py64870755editdlrm
default_styles.py82570755editdlrm
diagnose.py10250755editdlrm
emoji.py23670755editdlrm
errors.py6420755editdlrm
filesize.py24840755editdlrm
file_proxy.py16830755editdlrm
highlighter.py95860755editdlrm
json.py50310755editdlrm
jupyter.py32520755editdlrm
layout.py140040755editdlrm
LICENSE10560755editdlrm
live.py151800755editdlrm
live_render.py35210755editdlrm
logging.py124680755editdlrm
markup.py84510755editdlrm
measure.py53050755editdlrm
padding.py49080755editdlrm
pager.py8280755editdlrm
palette.py33960755editdlrm
panel.py111570755editdlrm
pretty.py363910755editdlrm
progress.py604080755editdlrm
progress_bar.py81620755editdlrm
prompt.py124470755editdlrm
protocol.py13910755editdlrm
py.typed00755editdlrm
region.py1660755editdlrm
repr.py44310755editdlrm
rule.py46020755editdlrm
scope.py28430755editdlrm
screen.py15910755editdlrm
segment.py247430755editdlrm
spinner.py42140755editdlrm
status.py44240755editdlrm
style.py269900755editdlrm
styled.py12580755editdlrm
syntax.py363710755editdlrm
table.py400490755editdlrm
terminal_theme.py33700755editdlrm
text.py475520755editdlrm
theme.py37710755editdlrm
themes.py1020755editdlrm
traceback.py358610755editdlrm
tree.py94510755editdlrm
_cell_widths.py102090755editdlrm
_emoji_codes.py1402350755editdlrm
_emoji_replace.py10640755editdlrm
_export_format.py21280755editdlrm
_extension.py2650755editdlrm
_fileno.py7990755editdlrm
_inspect.py96560755editdlrm
_log_render.py32250755editdlrm
_loop.py12360755editdlrm
_null_file.py13940755editdlrm
_palettes.py70630755editdlrm
_pick.py4230755editdlrm
_ratio.py53250755editdlrm
_spinners.py199190755editdlrm
_stack.py3510755editdlrm
_timer.py4170755editdlrm
_win32_console.py227550755editdlrm
_windows.py19250755editdlrm
_windows_renderer.py27830755editdlrm
_wrap.py34040755editdlrm
__init__.py60900755editdlrm
__main__.py78960755editdlrm
Edit: /opt/support/venv/lib/python3.13/site-packages/pip/_vendor/rich/live_render.py (3521B)
from typing import Optional, Tuple, Literal from ._loop import loop_last from .console import Console, ConsoleOptions, RenderableType, RenderResult from .control import Control from .segment import ControlType, Segment from .style import StyleType from .text import Text VerticalOverflowMethod = Literal["crop", "ellipsis", "visible"] class LiveRender: """Creates a renderable that may be updated. Args: renderable (RenderableType): Any renderable object. style (StyleType, optional): An optional style to apply to the renderable. Defaults to "". """ def __init__( self, renderable: RenderableType, style: StyleType = "", vertical_overflow: VerticalOverflowMethod = "ellipsis", ) -> None: self.renderable = renderable self.style = style self.vertical_overflow = vertical_overflow self._shape: Optional[Tuple[int, int]] = None def set_renderable(self, renderable: RenderableType) -> None: """Set a new renderable. Args: renderable (RenderableType): Any renderable object, including str. """ self.renderable = renderable def position_cursor(self) -> Control: """Get control codes to move cursor to beginning of live render. Returns: Control: A control instance that may be printed. """ if self._shape is not None: _, height = self._shape return Control( ControlType.CARRIAGE_RETURN, (ControlType.ERASE_IN_LINE, 2), *( ( (ControlType.CURSOR_UP, 1), (ControlType.ERASE_IN_LINE, 2), ) * (height - 1) ) ) return Control() def restore_cursor(self) -> Control: """Get control codes to clear the render and restore the cursor to its previous position. Returns: Control: A Control instance that may be printed. """ if self._shape is not None: _, height = self._shape return Control( ControlType.CARRIAGE_RETURN, *((ControlType.CURSOR_UP, 1), (ControlType.ERASE_IN_LINE, 2)) * height ) return Control() def __rich_console__( self, console: Console, options: ConsoleOptions ) -> RenderResult: renderable = self.renderable style = console.get_style(self.style) lines = console.render_lines(renderable, options, style=style, pad=False) shape = Segment.get_shape(lines) _, height = shape if height > options.size.height: if self.vertical_overflow == "crop": lines = lines[: options.size.height] shape = Segment.get_shape(lines) elif self.vertical_overflow == "ellipsis": lines = lines[: (options.size.height - 1)] overflow_text = Text( "...", overflow="crop", justify="center", end="", style="live.ellipsis", ) lines.append(list(console.render(overflow_text))) shape = Segment.get_shape(lines) self._shape = shape new_line = Segment.line() for last, line in loop_last(lines): yield from line if not last: yield new_line