/usr/local/lib/python3.9/site-packages/pip/_vendor/rich
from typing import TYPE_CHECKING from .measure import Measurement from .segment import Segment from .style import StyleType if TYPE_CHECKING: from .console import Console, ConsoleOptions, RenderResult, RenderableType class Styled: """Apply a style to a renderable. Args: renderable (RenderableType): Any renderable. style (StyleType): A style to apply across the entire renderable. """ def __init__(self, renderable: "RenderableType", style: "StyleType") -> None: self.renderable = renderable self.style = style def __rich_console__( self, console: "Console", options: "ConsoleOptions" ) -> "RenderResult": style = console.get_style(self.style) rendered_segments = console.render(self.renderable, options) segments = Segment.apply_style(rendered_segments, style) return segments def __rich_measure__( self, console: "Console", options: "ConsoleOptions" ) -> Measurement: return Measurement.get(console, options, self.renderable) if __name__ == "__main__": # pragma: no cover from pip._vendor.rich import print from pip._vendor.rich.panel import Panel panel = Styled(Panel("hello"), "on blue") print(panel)
.
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