PATH:
opt
/
imunify360
/
venv
/
lib
/
python3.11
/
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)
[-] jupyter.py
[edit]
[-] errors.py
[edit]
[-] progress_bar.py
[edit]
[-] _log_render.py
[edit]
[-] pretty.py
[edit]
[-] spinner.py
[edit]
[-] _inspect.py
[edit]
[-] _windows_renderer.py
[edit]
[-] segment.py
[edit]
[-] repr.py
[edit]
[-] live_render.py
[edit]
[-] live.py
[edit]
[-] _windows.py
[edit]
[-] panel.py
[edit]
[-] default_styles.py
[edit]
[-] ansi.py
[edit]
[-] _fileno.py
[edit]
[-] highlighter.py
[edit]
[+]
..
[-] constrain.py
[edit]
[-] measure.py
[edit]
[-] _win32_console.py
[edit]
[-] themes.py
[edit]
[-] layout.py
[edit]
[-] color.py
[edit]
[-] _timer.py
[edit]
[-] _palettes.py
[edit]
[-] _emoji_codes.py
[edit]
[-] __main__.py
[edit]
[-] _extension.py
[edit]
[-] emoji.py
[edit]
[-] theme.py
[edit]
[-] _pick.py
[edit]
[-] style.py
[edit]
[-] screen.py
[edit]
[-] syntax.py
[edit]
[-] py.typed
[edit]
[-] abc.py
[edit]
[-] region.py
[edit]
[-] palette.py
[edit]
[-] _export_format.py
[edit]
[-] protocol.py
[edit]
[-] text.py
[edit]
[-] prompt.py
[edit]
[-] status.py
[edit]
[+]
__pycache__
[-] align.py
[edit]
[-] color_triplet.py
[edit]
[-] bar.py
[edit]
[-] control.py
[edit]
[-] styled.py
[edit]
[-] progress.py
[edit]
[-] console.py
[edit]
[-] scope.py
[edit]
[-] traceback.py
[edit]
[-] _null_file.py
[edit]
[-] rule.py
[edit]
[-] logging.py
[edit]
[-] box.py
[edit]
[-] table.py
[edit]
[-] terminal_theme.py
[edit]
[-] _spinners.py
[edit]
[-] filesize.py
[edit]
[-] padding.py
[edit]
[-] __init__.py
[edit]
[-] _wrap.py
[edit]
[-] columns.py
[edit]
[-] _cell_widths.py
[edit]
[-] markup.py
[edit]
[-] containers.py
[edit]
[-] json.py
[edit]
[-] diagnose.py
[edit]
[-] _loop.py
[edit]
[-] _ratio.py
[edit]
[-] _emoji_replace.py
[edit]
[-] pager.py
[edit]
[-] tree.py
[edit]
[-] file_proxy.py
[edit]
[-] _stack.py
[edit]
[-] cells.py
[edit]