/usr/local/lib/python3.9/site-packages/pip/_vendor/rich
from typing import Iterable, Sequence, Tuple, cast from pip._vendor.rich._win32_console import LegacyWindowsTerm, WindowsCoordinates from pip._vendor.rich.segment import ControlCode, ControlType, Segment def legacy_windows_render(buffer: Iterable[Segment], term: LegacyWindowsTerm) -> None: """Makes appropriate Windows Console API calls based on the segments in the buffer. Args: buffer (Iterable[Segment]): Iterable of Segments to convert to Win32 API calls. term (LegacyWindowsTerm): Used to call the Windows Console API. """ for text, style, control in buffer: if not control: if style: term.write_styled(text, style) else: term.write_text(text) else: control_codes: Sequence[ControlCode] = control for control_code in control_codes: control_type = control_code[0] if control_type == ControlType.CURSOR_MOVE_TO: _, x, y = cast(Tuple[ControlType, int, int], control_code) term.move_cursor_to(WindowsCoordinates(row=y - 1, col=x - 1)) elif control_type == ControlType.CARRIAGE_RETURN: term.write_text("\r") elif control_type == ControlType.HOME: term.move_cursor_to(WindowsCoordinates(0, 0)) elif control_type == ControlType.CURSOR_UP: term.move_cursor_up() elif control_type == ControlType.CURSOR_DOWN: term.move_cursor_down() elif control_type == ControlType.CURSOR_FORWARD: term.move_cursor_forward() elif control_type == ControlType.CURSOR_BACKWARD: term.move_cursor_backward() elif control_type == ControlType.CURSOR_MOVE_TO_COLUMN: _, column = cast(Tuple[ControlType, int], control_code) term.move_cursor_to_column(column - 1) elif control_type == ControlType.HIDE_CURSOR: term.hide_cursor() elif control_type == ControlType.SHOW_CURSOR: term.show_cursor() elif control_type == ControlType.ERASE_IN_LINE: _, mode = cast(Tuple[ControlType, int], control_code) if mode == 0: term.erase_end_of_line() elif mode == 1: term.erase_start_of_line() elif mode == 2: term.erase_line() elif control_type == ControlType.SET_WINDOW_TITLE: _, title = cast(Tuple[ControlType, str], control_code) term.set_title(title)
.
Edit
..
Edit
__init__.py
Edit
__main__.py
Edit
__pycache__
Edit
_cell_widths.py
Edit
_emoji_codes.py
Edit
_emoji_replace.py
Edit
_export_format.py
Edit
_extension.py
Edit
_fileno.py
Edit
_inspect.py
Edit
_log_render.py
Edit
_loop.py
Edit
_null_file.py
Edit
_palettes.py
Edit
_pick.py
Edit
_ratio.py
Edit
_spinners.py
Edit
_stack.py
Edit
_timer.py
Edit
_win32_console.py
Edit
_windows.py
Edit
_windows_renderer.py
Edit
_wrap.py
Edit
abc.py
Edit
align.py
Edit
ansi.py
Edit
bar.py
Edit
box.py
Edit
cells.py
Edit
color.py
Edit
color_triplet.py
Edit
columns.py
Edit
console.py
Edit
constrain.py
Edit
containers.py
Edit
control.py
Edit
default_styles.py
Edit
diagnose.py
Edit
emoji.py
Edit
errors.py
Edit
file_proxy.py
Edit
filesize.py
Edit
highlighter.py
Edit
json.py
Edit
jupyter.py
Edit
layout.py
Edit
live.py
Edit
live_render.py
Edit
logging.py
Edit
markup.py
Edit
measure.py
Edit
padding.py
Edit
pager.py
Edit
palette.py
Edit
panel.py
Edit
pretty.py
Edit
progress.py
Edit
progress_bar.py
Edit
prompt.py
Edit
protocol.py
Edit
py.typed
Edit
region.py
Edit
repr.py
Edit
rule.py
Edit
scope.py
Edit
screen.py
Edit
segment.py
Edit
spinner.py
Edit
status.py
Edit
style.py
Edit
styled.py
Edit
syntax.py
Edit
table.py
Edit
terminal_theme.py
Edit
text.py
Edit
theme.py
Edit
themes.py
Edit
traceback.py
Edit
tree.py
Edit