brk-code

rich の API リファレンス

rich (Textualize/rich) の公開 API 400 件 —— クラス 126、関数 51、メソッド 223。実際のソースを静的解析して抽出した正確なシグネチャを掲載しています。

リポジトリ: Textualize/rich

種別件数
クラス126
関数51
メソッド223

API 一覧

funcrich.__main__.make_test_card() -> Table
Get a renderable that demonstrates a number of features.
classrich._inspect.Inspect
A renderable to inspect any Python Object.
funcrich._inspect.Inspect.safe_getattr(attr_name:str) -> Tuple[Any, Any]
Get attribute or any exception.
funcrich._loop.loop_first(values:Iterable[T]) -> Iterable[Tuple[bool, T]]
Iterate and generate a tuple with a flag for first value.
funcrich._loop.loop_last(values:Iterable[T]) -> Iterable[Tuple[bool, T]]
Iterate and generate a tuple with a flag for last value.
funcrich._pick.pick_bool(*values:Optional[bool]) -> bool
Pick the first non-none bool or return the last value.
classrich._ratio.Edge
Any object that defines an edge (such as Layout).
funcrich._ratio.ratio_distribute(total:int, ratios:List[int], minimums:Optional[List[int]]=None) -> List[int]
Distribute an integer total in to parts based on ratios.
funcrich._ratio.ratio_reduce(total:int, ratios:List[int], maximums:List[int], values:List[int]) -> List[int]
Divide an integer total in to parts based on ratios.
classrich._stack.Stack
A small shim over builtin list.
methodrich._stack.Stack.push(item:T) -> None
Push an item on to the stack (append in stack nomenclature).
methodrich._stack.Stack.top() -> T
Get top of stack.
funcrich._timer.timer(subject:str='time') -> Generator[None, None, None]
print the elapsed time.
funcrich._unicode_data.load(unicode_version:str='auto') -> CellTable
Load a cell table for the given unicode version.
classrich._windows.WindowsConsoleFeatures
Windows features available.
classrich.abc.RichRenderable
An abstract base class for Rich renderables.
classrich.align.Align
Align a renderable by adding spaces if necessary.
methodrich.align.Align.center(renderable:'RenderableType', style:Optional[StyleType]=None, *vertical:Optional[VerticalAlignMethod]=None, *pad:bool=True, *width:Optional[int]=None, *height:Optional[int]=None) -> 'Align'
Align a renderable to the center.
methodrich.align.Align.left(renderable:'RenderableType', style:Optional[StyleType]=None, *vertical:Optional[VerticalAlignMethod]=None, *pad:bool=True, *width:Optional[int]=None, *height:Optional[int]=None) -> 'Align'
Align a renderable to the left.
methodrich.align.Align.right(renderable:'RenderableType', style:Optional[StyleType]=None, *vertical:Optional[VerticalAlignMethod]=None, *pad:bool=True, *width:Optional[int]=None, *height:Optional[int]=None) -> 'Align'
Align a renderable to the right.
classrich.align.VerticalCenter
Vertically aligns a renderable.
classrich.ansi.AnsiDecoder
Translate ANSI code in to styled Text.
methodrich.ansi.AnsiDecoder.decode(terminal_text:str) -> Iterable[Text]
Decode ANSI codes in an iterable of lines.
methodrich.ansi.AnsiDecoder.decode_line(line:str) -> Text
Decode a line containing ansi codes.
classrich.bar.Bar
Renders a solid block bar.
classrich.box.Box
Defines characters to render boxes.
methodrich.box.Box.get_bottom(widths:Iterable[int]) -> str
Get the bottom of a simple box.
methodrich.box.Box.get_row(widths:Iterable[int], level:Literal['head', 'row', 'foot', 'mid']='row', edge:bool=True) -> str
Get the top of a simple box.
methodrich.box.Box.get_top(widths:Iterable[int]) -> str
Get the top of a simple box.
funcrich.cells.cached_cell_len(text:str, unicode_version:str='auto') -> int
Get the number of cells required to display text.
funcrich.cells.cell_len(text:str, unicode_version:str='auto') -> int
Get the cell length of a string (length as it appears in the terminal).
funcrich.cells.get_character_cell_size(character:str, unicode_version:str='auto') -> int
Get the cell size of a character.
funcrich.cells.split_text(text:str, cell_position:int, unicode_version:str='auto') -> tuple[str, str]
Split text by cell position.
classrich.color.Color
Terminal color definition.
methodrich.color.Color.default() -> 'Color'
Get a Color instance representing the default color.
methodrich.color.Color.downgrade(system:ColorSystem) -> 'Color'
Downgrade a color system to a system with fewer colors.
methodrich.color.Color.from_ansi(number:int) -> 'Color'
Create a Color number from it's 8-bit ansi number.
methodrich.color.Color.from_rgb(red:float, green:float, blue:float) -> 'Color'
Create a truecolor from three color components in the range(0->255).
methodrich.color.Color.from_triplet(triplet:'ColorTriplet') -> 'Color'
Create a truecolor RGB color from a triplet of values.
methodrich.color.Color.get_ansi_codes(foreground:bool=True) -> Tuple[str, ...]
Get the ANSI escape codes for this color.
methodrich.color.Color.get_truecolor(theme:Optional['TerminalTheme']=None, foreground:bool=True) -> ColorTriplet
Get an equivalent color triplet for this color.
methodrich.color.Color.is_default() -> bool
Check if the color is a default color.
methodrich.color.Color.is_system_defined() -> bool
Check if the color is ultimately defined by the system.
methodrich.color.Color.parse(color:str) -> 'Color'
Parse a color definition.
methodrich.color.Color.system() -> ColorSystem
Get the native color system for this color.
classrich.color.ColorParseError
The color could not be parsed.
classrich.color.ColorSystem
One of the 3 color system supported by terminals.
classrich.color.ColorType
Type of color stored in Color class.
funcrich.color.blend_rgb(color1:ColorTriplet, color2:ColorTriplet, cross_fade:float=0.5) -> ColorTriplet
Blend one RGB color in to another.
funcrich.color.parse_rgb_hex(hex_color:str) -> ColorTriplet
Parse six hex characters in to RGB triplet.
classrich.color_triplet.ColorTriplet
The red, green, and blue components of a color.
methodrich.color_triplet.ColorTriplet.hex() -> str
get the color triplet in CSS style.
methodrich.color_triplet.ColorTriplet.normalized() -> Tuple[float, float, float]
Convert components into floats between 0 and 1.
methodrich.color_triplet.ColorTriplet.rgb() -> str
The color in RGB format.
classrich.columns.Columns
Display renderables in neat columns.
methodrich.columns.Columns.add_renderable(renderable:RenderableType) -> None
Add a renderable to the columns.
classrich.console.Capture
Context manager to capture the result of printing to the console.
methodrich.console.Capture.get() -> str
Get the result of the capture.
classrich.console.CaptureError
An error in the Capture context manager.
classrich.console.Console
A high level console interface.
methodrich.console.Console.begin_capture() -> None
Begin capturing console output.
methodrich.console.Console.bell() -> None
Play a 'bell' sound (if supported by the terminal).
methodrich.console.Console.clear(home:bool=True) -> None
Clear the screen.
methodrich.console.Console.clear_live() -> None
Clear the Live instance.
methodrich.console.Console.color_system() -> Optional[str]
Get color system string.
methodrich.console.Console.control(*control:Control) -> None
Insert non-printing control codes.
methodrich.console.Console.encoding() -> str
Get the encoding of the console file, e.g.
methodrich.console.Console.end_capture() -> str
End capture mode and return captured string.
funcrich.console.Console.escape_text(text:str) -> str
HTML escape text and replace spaces with nbsp.
methodrich.console.Console.file() -> IO[str]
Get the file object to write to.
methodrich.console.Console.get_style(name:Union[str, Style], *default:Optional[Union[Style, str]]=None) -> Style
Get a Style instance by its theme name or parse a definition.
funcrich.console.Console.get_svg_style(style:Style) -> str
Convert a Style to CSS rules for SVG.
methodrich.console.Console.height() -> int
Get the height of the console.
methodrich.console.Console.input(prompt:TextType='', *markup:bool=True, *emoji:bool=True, *password:bool=False, *stream:Optional[TextIO]=None) -> str
Displays a prompt and waits for input from the user.
methodrich.console.Console.is_alt_screen() -> bool
Check if the alt screen was enabled.
methodrich.console.Console.is_dumb_terminal() -> bool
Detect dumb terminal.
funcrich.console.Console.is_expandable(obj:object) -> bool
Check if an object is expandable by pretty printer.
methodrich.console.Console.is_terminal() -> bool
Check if the console is writing to a terminal.
methodrich.console.Console.line(count:int=1) -> None
Write new line(s).
funcrich.console.Console.make_tag(name:str, content:Optional[str]=None, **attribs:object) -> str
Make a tag from name, content, and attributes.
methodrich.console.Console.measure(renderable:RenderableType, *options:Optional[ConsoleOptions]=None) -> Measurement
Measure a renderable.
methodrich.console.Console.on_broken_pipe() -> None
This function is called when a `BrokenPipeError` is raised.
methodrich.console.Console.options() -> ConsoleOptions
Get default console options.
methodrich.console.Console.out(*sep:str=' ', *end:str='\n', *style:Optional[Union[str, Style]]=None, *highlight:Optional[bool]=None, *objects:Any) -> None
Output to the terminal.
methodrich.console.Console.pop_render_hook() -> None
Pop the last renderhook from the stack.
methodrich.console.Console.pop_theme() -> None
Remove theme from top of stack, restoring previous theme.
methodrich.console.Console.push_render_hook(hook:RenderHook) -> None
Add a new render hook to the stack.
methodrich.console.Console.render(renderable:RenderableType, options:Optional[ConsoleOptions]=None) -> Iterable[Segment]
Render an object in to an iterable of `Segment` instances.
methodrich.console.Console.render_lines(renderable:RenderableType, options:Optional[ConsoleOptions]=None, *style:Optional[Style]=None, *pad:bool=True, *new_lines:bool=False) -> List[List[Segment]]
Render objects in to a list of lines.
methodrich.console.Console.rule(title:TextType='', *characters:str='─', *style:Union[str, Style]='rule.line', *align:AlignMethod='center') -> None
Draw a line with optional centered title.
methodrich.console.Console.set_alt_screen(enable:bool=True) -> bool
Enables alternative screen mode.
methodrich.console.Console.set_live(live:'Live') -> bool
Set Live instance.
methodrich.console.Console.set_window_title(title:str) -> bool
Set the title of the console terminal window.
methodrich.console.Console.show_cursor(show:bool=True) -> bool
Show or hide the cursor.
methodrich.console.Console.size() -> ConsoleDimensions
Get the size of the console.
methodrich.console.Console.status(status:RenderableType, *spinner:str='dots', *spinner_style:StyleType='status.spinner', *speed:float=1.0, *refresh_per_second:float=12.5) -> 'Status'
Display a status and spinner.
methodrich.console.Console.update_screen(renderable:RenderableType, *region:Optional[Region]=None, *options:Optional[ConsoleOptions]=None) -> None
Update the screen at a given offset.
methodrich.console.Console.update_screen_lines(lines:List[List[Segment]], x:int=0, y:int=0) -> None
Update lines of the screen at a given offset.
methodrich.console.Console.use_theme(theme:Theme, *inherit:bool=True) -> ThemeContext
Use a different theme for the duration of the context manager.
methodrich.console.Console.width() -> int
Get the width of the console.
classrich.console.ConsoleDimensions
Size of the terminal.
classrich.console.ConsoleOptions
Options for __rich_console__ method.
methodrich.console.ConsoleOptions.ascii_only() -> bool
Check if renderables should use ascii only.
methodrich.console.ConsoleOptions.copy() -> 'ConsoleOptions'
Return a copy of the options.
methodrich.console.ConsoleOptions.reset_height() -> 'ConsoleOptions'
Return a copy of the options with height set to ``None``.
methodrich.console.ConsoleOptions.update_dimensions(width:int, height:int) -> 'ConsoleOptions'
Update the width and height, and return a copy.
methodrich.console.ConsoleOptions.update_height(height:int) -> 'ConsoleOptions'
Update the height, and return a copy.
methodrich.console.ConsoleOptions.update_width(width:int) -> 'ConsoleOptions'
Update just the width, return a copy.
classrich.console.ConsoleRenderable
An object that supports the console protocol.
classrich.console.ConsoleThreadLocals
Thread local values for Console context.
classrich.console.NewLine
A renderable to generate new line(s)
classrich.console.PagerContext
A context manager that 'pages' content.
classrich.console.RenderHook
Provides hooks in to the render process.
methodrich.console.RenderHook.process_renderables(renderables:List[ConsoleRenderable]) -> List[ConsoleRenderable]
Called with a list of objects to render.
classrich.console.RichCast
An object that may be 'cast' to a console renderable.
classrich.console.ScreenContext
A context manager that enables an alternative screen.
methodrich.console.ScreenContext.update(*style:Optional[StyleType]=None, *renderables:RenderableType) -> None
Update the screen.
classrich.console.ScreenUpdate
Render a list of lines at a given offset.
classrich.console.ThemeContext
A context manager to use a temporary theme.
funcrich.console.detect_legacy_windows() -> bool
Detect legacy Windows.
funcrich.console.group(fit:bool=True) -> Callable[..., Callable[..., Group]]
A decorator that turns an iterable of renderables in to a group.
classrich.containers.Lines
A list subclass which can render to the console.
methodrich.containers.Lines.justify(console:'Console', width:int, justify:'JustifyMethod'='left', overflow:'OverflowMethod'='fold') -> None
Justify and overflow text to a given width.
classrich.containers.Renderables
A list subclass which renders its contents to the console.
methodrich.control.Control.alt_screen(enable:bool) -> 'Control'
Enable or disable alt screen.
methodrich.control.Control.bell() -> 'Control'
Ring the 'bell'.
methodrich.control.Control.clear() -> 'Control'
Clear the screen.
methodrich.control.Control.home() -> 'Control'
Move cursor to 'home' position.
methodrich.control.Control.move(x:int=0, y:int=0) -> 'Control'
Move cursor relative to current position.
methodrich.control.Control.move_to(x:int, y:int) -> 'Control'
Move cursor to absolute position.
methodrich.control.Control.move_to_column(x:int, y:int=0) -> 'Control'
Move to the given column, optionally add offset to row.
methodrich.control.Control.show_cursor(show:bool) -> 'Control'
Show or hide the cursor.
funcrich.control.strip_control_codes(text:str, _translate_table:Dict[int, None]=_CONTROL_STRIP_TRANSLATE) -> str
Remove control codes from text.
funcrich.diagnose.report() -> None
Print a report to the terminal with debugging information
classrich.emoji.NoEmoji
No emoji by that name.
classrich.errors.ConsoleError
An error in console operation.
classrich.errors.LiveError
Error related to Live display.
classrich.errors.MarkupError
Markup was badly formatted.
classrich.errors.MissingStyle
No such style.
classrich.errors.NoAltScreen
Alt screen mode was required.
classrich.errors.NotRenderableError
Object is not renderable.
classrich.errors.StyleError
An error in styles.
classrich.errors.StyleStackError
Style stack is invalid.
classrich.errors.StyleSyntaxError
Style was badly formatted.
classrich.file_proxy.FileProxy
Wraps a file (e.g.
methodrich.file_proxy.FileProxy.rich_proxied_file() -> IO[str]
Get proxied file.
funcrich.filesize.decimal(size:int, *precision:Optional[int]=1, *separator:Optional[str]=' ') -> str
Convert a filesize in to a string (powers of 1000, SI prefixes).
funcrich.filesize.pick_unit_and_suffix(size:int, suffixes:List[str], base:int) -> Tuple[int, str]
Pick a suffix and base for the given size.
funcrich.get_console() -> 'Console'
Get a global :class:`~rich.console.Console` instance.
classrich.highlighter.Highlighter
Abstract base class for highlighters.
methodrich.highlighter.Highlighter.highlight(text:Text) -> None
Apply highlighting in place to text.
classrich.highlighter.ISO8601Highlighter
Highlights the ISO8601 date time strings.
classrich.highlighter.JSONHighlighter
Highlights JSON
classrich.highlighter.NullHighlighter
A highlighter object that doesn't highlight.
methodrich.highlighter.NullHighlighter.highlight(text:Text) -> None
Nothing to do
classrich.highlighter.RegexHighlighter
Applies highlighting from a list of regular expressions.
methodrich.highlighter.RegexHighlighter.highlight(text:Text) -> None
Highlight :class:`rich.text.Text` using regular expressions.
funcrich.inspect(obj:Any, *console:Optional['Console']=None, *title:Optional[str]=None, *help:bool=False, *methods:bool=False, *docs:bool=True, *private:bool=False, *dunder:bool=False, *sort:bool=True, *all:bool=False, *value:bool=True) -> None
Inspect any Python object.
classrich.json.JSON
A renderable which pretty prints JSON.
classrich.jupyter.JupyterMixin
Add to an Rich renderable to make it render in Jupyter notebook.
classrich.jupyter.JupyterRenderable
A shim to write html to Jupyter notebook.
funcrich.jupyter.display(segments:Iterable[Segment], text:str) -> None
Render segments to Jupyter.
funcrich.jupyter.escape(text:str) -> str
Escape html.
funcrich.jupyter.print(*args:Any, **kwargs:Any) -> None
Proxy for Console print.
classrich.layout.ColumnSplitter
Split a layout region in to columns.
classrich.layout.Layout
A renderable to divide a fixed height in to rows or columns.
methodrich.layout.Layout.add_split(*layouts:Union['Layout', RenderableType]) -> None
Add a new layout(s) to existing split.
methodrich.layout.Layout.children() -> List['Layout']
Gets (visible) layout children.
methodrich.layout.Layout.get(name:str) -> Optional['Layout']
Get a named layout, or None if it doesn't exist.
methodrich.layout.Layout.map() -> RenderMap
Get a map of the last render.
methodrich.layout.Layout.refresh_screen(console:'Console', layout_name:str) -> None
Refresh a sub-layout.
methodrich.layout.Layout.render(console:Console, options:ConsoleOptions) -> RenderMap
Render the sub_layouts.
methodrich.layout.Layout.renderable() -> RenderableType
Layout renderable.
methodrich.layout.Layout.split(*splitter:Union[Splitter, str]='column', *layouts:Union['Layout', RenderableType]) -> None
Split the layout in to multiple sub-layouts.
methodrich.layout.Layout.split_row(*layouts:Union['Layout', RenderableType]) -> None
Split the layout in to a row (layouts side by side).
methodrich.layout.Layout.tree() -> 'Tree'
Get a tree renderable to show layout structure.
methodrich.layout.Layout.unsplit() -> None
Reset splits to initial state.
methodrich.layout.Layout.update(renderable:RenderableType) -> None
Update renderable.
classrich.layout.LayoutError
Layout related error.
classrich.layout.LayoutRender
An individual layout render.
classrich.layout.NoSplitter
Requested splitter does not exist.
classrich.layout.RowSplitter
Split a layout region in to rows.
classrich.layout.Splitter
Base class for a splitter.
methodrich.layout.Splitter.divide(children:Sequence['Layout'], region:Region) -> Iterable[Tuple['Layout', Region]]
Divide a region amongst several child layouts.
methodrich.layout.Splitter.get_tree_icon() -> str
Get the icon (emoji) used in layout.tree
classrich.live.Live
Renders an auto-updating live display of any given renderable.
methodrich.live.Live.is_started() -> bool
Check if live display has been started.
methodrich.live.Live.process_renderables(renderables:List[ConsoleRenderable]) -> List[ConsoleRenderable]
Process renderables to restore cursor and display progress.
methodrich.live.Live.refresh() -> None
Update the display of the Live Render.
methodrich.live.Live.start(refresh:bool=False) -> None
Start live rendering display.
methodrich.live.Live.stop() -> None
Stop live rendering display.
classrich.live_render.LiveRender
Creates a renderable that may be updated.
methodrich.live_render.LiveRender.set_renderable(renderable:RenderableType) -> None
Set a new renderable.
classrich.logging.RichHandler
A logging handler that renders output with Rich.
methodrich.logging.RichHandler.emit(record:LogRecord) -> None
Invoked by logging.
methodrich.logging.RichHandler.get_level_text(record:LogRecord) -> Text
Get the level name from the record.
methodrich.logging.RichHandler.render(*record:LogRecord, *traceback:Optional[Traceback], *message_renderable:ConsoleRenderable) -> ConsoleRenderable
Render log for display.
methodrich.logging.RichHandler.render_message(record:LogRecord, message:str) -> ConsoleRenderable
Render message text in to Text.
classrich.markdown.BlockQuote
A block quote.
classrich.markdown.CodeBlock
A code block with syntax highlighting.
classrich.markdown.Heading
A heading.
classrich.markdown.HorizontalRule
A horizontal rule to divide sections.
classrich.markdown.ImageItem
Renders a placeholder for an image.
classrich.markdown.ListElement
A list element.
classrich.markdown.ListItem
An item in a list.
classrich.markdown.Markdown
A Markdown renderable.
classrich.markdown.MarkdownContext
Manages the console render state.
methodrich.markdown.MarkdownContext.enter_style(style_name:str | Style) -> Style
Enter a style context.
methodrich.markdown.MarkdownContext.leave_style() -> Style
Leave a style context.
methodrich.markdown.MarkdownContext.on_text(text:str, node_type:str) -> None
Called when the parser visits text.
classrich.markdown.Paragraph
A Paragraph.
classrich.markdown.TableElement
MarkdownElement corresponding to `table_open`.
classrich.markdown.TableRowElement
MarkdownElement corresponding to `tr_open` and `tr_close`.
classrich.markdown.TextElement
Base class for elements that render text.
classrich.markdown.UnknownElement
An unknown element.
classrich.markup.Tag
A tag in console markup.
methodrich.markup.Tag.markup() -> str
Get the string representation of this tag.
funcrich.markup.escape(markup:str, _escape:_EscapeSubMethod=re.compile('(\\\\*)(\\[[a-z#/@][^[]*?])').sub) -> str
Escapes text so that it won't be interpreted as markup.
funcrich.markup.escape_backslashes(match:Match[str]) -> str
Called by re.sub replace matches.
funcrich.markup.pop_style(style_name:str) -> Tuple[int, Tag]
Pop tag matching given style name.
funcrich.markup.render(markup:str, style:Union[str, Style]='', emoji:bool=True, emoji_variant:Optional[EmojiVariant]=None) -> Text
Render console markup in to a Text instance.
methodrich.measure.Measurement.clamp(min_width:Optional[int]=None, max_width:Optional[int]=None) -> 'Measurement'
Clamp a measurement within the specified range.
methodrich.measure.Measurement.get(console:'Console', options:'ConsoleOptions', renderable:'RenderableType') -> 'Measurement'
Get a measurement for a renderable.
methodrich.measure.Measurement.span() -> int
Get difference between maximum and minimum.
methodrich.measure.Measurement.with_maximum(width:int) -> 'Measurement'
Get a RenderableWith where the widths are <= width.
methodrich.measure.Measurement.with_minimum(width:int) -> 'Measurement'
Get a RenderableWith where the widths are >= width.
classrich.padding.Padding
Draw space around content.
methodrich.padding.Padding.indent(renderable:'RenderableType', level:int) -> 'Padding'
Make padding instance to render an indent.
methodrich.padding.Padding.unpack(pad:'PaddingDimensions') -> Tuple[int, int, int, int]
Unpack padding specified in CSS style.
classrich.pager.Pager
Base class for a pager.
methodrich.pager.Pager.show(content:str) -> None
Show content in pager.
classrich.pager.SystemPager
Uses the pager installed on the system.
methodrich.pager.SystemPager.show(content:str) -> None
Use the same pager used by pydoc.
classrich.palette.Palette
A palette of available colors.
funcrich.palette.Palette.get_color_distance(index:int) -> float
Get the distance to a color.
methodrich.palette.Palette.match(color:Tuple[int, int, int]) -> int
Find a color from a palette that most closely matches a given color.
classrich.panel.Panel
A console renderable that draws a border around its contents.
funcrich.panel.Panel.align_text(text:Text, width:int, align:str, character:str, style:Style) -> Text
Gets new aligned text.
classrich.pretty.Node
A node in a repr tree.
methodrich.pretty.Node.check_length(start_length:int, max_length:int) -> bool
Check the length fits within a limit.
methodrich.pretty.Node.iter_tokens() -> Iterable[str]
Generate tokens for this node.
methodrich.pretty.Node.render(max_width:int=80, indent_size:int=4, expand_all:bool=False) -> str
Render the node to a pretty repr.
classrich.pretty.Pretty
A rich renderable that pretty prints an object.
funcrich.pretty.display_hook(value:Any) -> None
Replacement sys.displayhook which prettifies objects with Rich.
funcrich.pretty.is_expandable(obj:Any) -> bool
Check if an object may be expanded by pretty print.
funcrich.pretty.iter_attrs() -> Iterable[Tuple[str, Any, Optional[Callable[[Any], str]]]]
Iterate over attr fields and values.
funcrich.pretty.to_repr(obj:Any) -> str
Get repr string for an object, but catch errors.
funcrich.pretty.traverse(_object:Any, max_length:Optional[int]=None, max_string:Optional[int]=None, max_depth:Optional[int]=None) -> Node
Traverse object and generate a tree.
funcrich.print(*sep:str=' ', *end:str='\n', *file:Optional[IO[str]]=None, *flush:bool=False, *objects:Any) -> None
Print object(s) supplied via positional arguments.
funcrich.print_json(json:Optional[str]=None, *data:Any=None, *indent:Union[None, int, str]=2, *highlight:bool=True, *skip_keys:bool=False, *ensure_ascii:bool=False, *check_circular:bool=True, *allow_nan:bool=True, *default:Optional[Callable[[Any], Any]]=None, *sort_keys:bool=False) -> None
Pretty prints JSON.
classrich.progress.BarColumn
Renders a visual progress bar.
methodrich.progress.BarColumn.render(task:'Task') -> ProgressBar
Gets a progress bar widget for a task.
classrich.progress.DownloadColumn
Renders file size downloaded and total, e.g.
methodrich.progress.DownloadColumn.render(task:'Task') -> Text
Calculate common unit for completed and total.
classrich.progress.FileSizeColumn
Renders completed filesize.
methodrich.progress.FileSizeColumn.render(task:'Task') -> Text
Show data completed.
classrich.progress.MofNCompleteColumn
Renders completed count/total, e.g.
methodrich.progress.MofNCompleteColumn.render(task:'Task') -> Text
Show completed/total.
classrich.progress.Progress
Renders an auto-updating progress bar(s).
methodrich.progress.Progress.add_task(description:str, start:bool=True, total:Optional[float]=100.0, completed:int=0, visible:bool=True, **fields:Any) -> TaskID
Add a new 'task' to the Progress display.
methodrich.progress.Progress.advance(task_id:TaskID, advance:float=1) -> None
Advance task by a number of steps.
methodrich.progress.Progress.finished() -> bool
Check if all tasks have been completed.
methodrich.progress.Progress.get_renderable() -> RenderableType
Get a renderable for the progress display.
methodrich.progress.Progress.get_renderables() -> Iterable[RenderableType]
Get a number of renderables for the progress display.
methodrich.progress.Progress.make_tasks_table(tasks:Iterable[Task]) -> Table
Get a table to render the Progress display.
methodrich.progress.Progress.refresh() -> None
Refresh (render) the progress information.
methodrich.progress.Progress.remove_task(task_id:TaskID) -> None
Delete a task if it exists.
methodrich.progress.Progress.start() -> None
Start the progress display.
methodrich.progress.Progress.start_task(task_id:TaskID) -> None
Start a task.
methodrich.progress.Progress.stop() -> None
Stop the progress display.
methodrich.progress.Progress.stop_task(task_id:TaskID) -> None
Stop a task.
methodrich.progress.Progress.task_ids() -> List[TaskID]
A list of task IDs.
methodrich.progress.Progress.wrap_file(file:BinaryIO, total:Optional[int]=None, *task_id:Optional[TaskID]=None, *description:str='Reading...') -> BinaryIO
Track progress file reading from a binary file.
classrich.progress.ProgressColumn
Base class for a widget to use in progress display.
methodrich.progress.ProgressColumn.get_table_column() -> Column
Get a table column, used to build tasks table.
methodrich.progress.ProgressColumn.render(task:'Task') -> RenderableType
Should return a renderable object.
classrich.progress.ProgressSample
Sample of progress for a given time.
classrich.progress.RenderableColumn
A column to insert an arbitrary column.
classrich.progress.SpinnerColumn
A column with a 'spinner' animation.
methodrich.progress.SpinnerColumn.set_spinner(spinner_name:str, spinner_style:Optional[StyleType]='progress.spinner', speed:float=1.0) -> None
Set a new spinner.
classrich.progress.Task
Information regarding a progress task.
methodrich.progress.Task.finished() -> bool
Check if the task has finished.
methodrich.progress.Task.get_time() -> float
float: Get the current time, in seconds.
methodrich.progress.Task.percentage() -> float
float: Get progress of task as a percentage.
methodrich.progress.Task.started() -> bool
bool: Check if the task as started.
classrich.progress.TaskProgressColumn
Show task progress as a percentage.
methodrich.progress.TaskProgressColumn.render_speed(speed:Optional[float]) -> Text
Render the speed in iterations per second.
classrich.progress.TextColumn
A column containing text.
classrich.progress.TimeElapsedColumn
Renders time elapsed.
methodrich.progress.TimeElapsedColumn.render(task:'Task') -> Text
Show time elapsed.
classrich.progress.TimeRemainingColumn
Renders estimated time remaining.
methodrich.progress.TimeRemainingColumn.render(task:'Task') -> Text
Show time remaining.
classrich.progress.TotalFileSizeColumn
Renders total filesize.
methodrich.progress.TotalFileSizeColumn.render(task:'Task') -> Text
Show data completed.
classrich.progress.TransferSpeedColumn
Renders human readable transfer speed.
methodrich.progress.TransferSpeedColumn.render(task:'Task') -> Text
Show data transfer speed.
classrich.progress_bar.ProgressBar
Renders a (progress) bar.
methodrich.progress_bar.ProgressBar.percentage_completed() -> Optional[float]
Calculate percentage complete.
methodrich.progress_bar.ProgressBar.update(completed:float, total:Optional[float]=None) -> None
Update progress with new values.
classrich.prompt.Confirm
A yes / no confirmation prompt.
methodrich.prompt.Confirm.process_response(value:str) -> bool
Convert choices to a bool.
methodrich.prompt.Confirm.render_default(default:DefaultType) -> Text
Render the default as (y) or (n) rather than True/False.
classrich.prompt.FloatPrompt
A prompt that returns a float.
classrich.prompt.IntPrompt
A prompt that returns an integer.
classrich.prompt.InvalidResponse
Exception to indicate a response was invalid.
classrich.prompt.Prompt
A prompt that returns a str.
classrich.prompt.PromptBase
Ask the user for input until a valid response is received.
methodrich.prompt.PromptBase.check_choice(value:str) -> bool
Check value is in the list of valid choices.
methodrich.prompt.PromptBase.get_input(console:Console, prompt:TextType, password:bool, stream:Optional[TextIO]=None) -> str
Get input from user.
methodrich.prompt.PromptBase.make_prompt(default:DefaultType) -> Text
Make prompt text.
methodrich.prompt.PromptBase.on_validate_error(value:str, error:InvalidResponse) -> None
Called to handle validation error.
methodrich.prompt.PromptBase.pre_prompt() -> None
Hook to display something before the prompt.
methodrich.prompt.PromptBase.process_response(value:str) -> PromptType
Process response from user, convert to prompt type.
methodrich.prompt.PromptBase.render_default(default:DefaultType) -> Text
Turn the supplied default in to a Text instance.
classrich.prompt.PromptError
Exception base class for prompt related errors.
funcrich.protocol.is_renderable(check_object:Any) -> bool
Check if an object may be rendered by Rich.
funcrich.protocol.rich_cast(renderable:object) -> 'RenderableType'
Cast an object to a renderable by calling __rich__ if present.
funcrich.reconfigure(*args:Any, **kwargs:Any) -> None
Reconfigures the global console by replacing it with another.
classrich.region.Region
Defines a rectangular region of the screen.
classrich.repr.ReprError
An error occurred when attempting to build a repr.
funcrich.repr.auto_repr(self:T) -> str
Create repr string from __rich_repr__
funcrich.repr.auto_rich_repr(self:Type[T]) -> Result
Auto generate __rich_rep__ from signature of __init__
classrich.rule.Rule
A console renderable to draw a horizontal rule (line).
funcrich.scope.sort_items(item:Tuple[str, Any]) -> Tuple[bool, str]
Sort special variables first, then alphabetically.
classrich.screen.Screen
A renderable that fills the terminal screen and crops excess.
classrich.segment.Segment
A piece of text with associated style.
methodrich.segment.Segment.apply_style(segments:Iterable['Segment'], style:Optional[Style]=None, post_style:Optional[Style]=None) -> Iterable['Segment']
Apply style(s) to an iterable of segments.
methodrich.segment.Segment.cell_length() -> int
The number of terminal cells required to display self.text.
methodrich.segment.Segment.divide(segments:Iterable['Segment'], cuts:Iterable[int]) -> Iterable[List['Segment']]
Divides an iterable of segments in to portions.
methodrich.segment.Segment.filter_control(segments:Iterable['Segment'], is_control:bool=False) -> Iterable['Segment']
Filter segments by ``is_control`` attribute.
methodrich.segment.Segment.get_line_length(line:List['Segment']) -> int
Get the length of list of segments.
methodrich.segment.Segment.get_shape(lines:List[List['Segment']]) -> Tuple[int, int]
Get the shape (enclosing rectangle) of a list of lines.
methodrich.segment.Segment.is_control() -> bool
Check if the segment contains control codes.
methodrich.segment.Segment.line() -> 'Segment'
Make a new line segment.
methodrich.segment.Segment.remove_color(segments:Iterable['Segment']) -> Iterable['Segment']
Remove all color from an iterable of segments.
methodrich.segment.Segment.split_cells(cut:int) -> Tuple['Segment', 'Segment']
Split segment in to two segments at the specified column.
methodrich.segment.Segment.split_lines(segments:Iterable['Segment']) -> Iterable[List['Segment']]
Split a sequence of segments in to a list of lines.
methodrich.segment.Segment.strip_links(segments:Iterable['Segment']) -> Iterable['Segment']
Remove all links from an iterable of styles.
methodrich.segment.Segment.strip_styles(segments:Iterable['Segment']) -> Iterable['Segment']
Remove all styles from an iterable of segments.
classrich.segment.Segments
A simple renderable to render an iterable of segments.
classrich.spinner.Spinner
A spinner animation.
methodrich.spinner.Spinner.render(time:float) -> 'RenderableType'
Render the spinner for a given time.
classrich.status.Status
Displays a status indicator with a 'spinner' animation.
methodrich.status.Status.console() -> 'Console'
Get the Console used by the Status objects.
methodrich.status.Status.start() -> None
Start the status animation.
methodrich.status.Status.stop() -> None
Stop the spinner animation.
methodrich.status.Status.update(status:Optional[RenderableType]=None, *spinner:Optional[str]=None, *spinner_style:Optional[StyleType]=None, *speed:Optional[float]=None) -> None
Update status.
classrich.style.Style
A terminal style.
methodrich.style.Style.background_style() -> 'Style'
A Style with background only.
methodrich.style.Style.bgcolor() -> Optional[Color]
The background color or None if it is not set.
methodrich.style.Style.chain(*styles:'Style') -> 'Style'
Combine styles from positional argument in to a single style.
methodrich.style.Style.color() -> Optional[Color]
The foreground color or None if it is not set.
methodrich.style.Style.combine(styles:Iterable['Style']) -> 'Style'
Combine styles and get result.
methodrich.style.Style.copy() -> 'Style'
Get a copy of this style.
methodrich.style.Style.from_color(color:Optional[Color]=None, bgcolor:Optional[Color]=None) -> 'Style'
Create a new style with colors and no attributes.
methodrich.style.Style.from_meta(meta:Optional[Dict[str, Any]]) -> 'Style'
Create a new style with meta data.
methodrich.style.Style.get_html_style(theme:Optional[TerminalTheme]=None) -> str
Get a CSS style rule.
methodrich.style.Style.link() -> Optional[str]
Link text, if set.
methodrich.style.Style.link_id() -> str
Get a link id, used in ansi code for links.
methodrich.style.Style.meta() -> Dict[str, Any]
Get meta information (can not be changed after construction).
methodrich.style.Style.null() -> 'Style'
Create an 'null' style, equivalent to Style(), but more performant.
methodrich.style.Style.on(meta:Optional[Dict[str, Any]]=None, **handlers:Any) -> 'Style'
Create a blank style with meta information.
methodrich.style.Style.parse(style_definition:str) -> 'Style'
Parse a style definition.
methodrich.style.Style.pick_first(*values:Optional[StyleType]) -> StyleType
Pick first non-None style.
methodrich.style.Style.render(text:str='', *color_system:Optional[ColorSystem]=ColorSystem.TRUECOLOR, *legacy_windows:bool=False) -> str
Render the ANSI codes for the style.
methodrich.style.Style.test(text:Optional[str]=None) -> None
Write text with style directly to terminal.
methodrich.style.Style.transparent_background() -> bool
Check if the style specified a transparent background.
methodrich.style.Style.update_link(link:Optional[str]=None) -> 'Style'
Get a copy with a different value for link.
methodrich.style.Style.without_color() -> 'Style'
Get a copy of the style with color removed.
classrich.style.StyleStack
A stack of styles.
methodrich.style.StyleStack.current() -> Style
Get the Style at the top of the stack.
methodrich.style.StyleStack.pop() -> Style
Pop last style and discard.
methodrich.style.StyleStack.push(style:Style) -> None
Push a new style on to the stack.
classrich.styled.Styled
Apply a style to a renderable.
classrich.syntax.ANSISyntaxTheme
Syntax theme to use standard colors.
methodrich.syntax.ANSISyntaxTheme.get_style_for_token(token_type:TokenType) -> Style
Look up style in the style map.
classrich.syntax.PaddingProperty
Descriptor to get and set padding.
classrich.syntax.PygmentsSyntaxTheme
Syntax theme that delegates to Pygments theme.
methodrich.syntax.PygmentsSyntaxTheme.get_style_for_token(token_type:TokenType) -> Style
Get a style from a Pygments class.
classrich.syntax.Syntax
Construct a Syntax object to render syntax highlighted code.
methodrich.syntax.Syntax.default_lexer() -> Lexer
A Pygments Lexer to use if one is not specified or invalid.
methodrich.syntax.Syntax.get_theme(name:Union[str, SyntaxTheme]) -> SyntaxTheme
Get a syntax theme instance.
methodrich.syntax.Syntax.highlight(code:str, line_range:Optional[Tuple[Optional[int], Optional[int]]]=None) -> Text
Highlight code and return a Text instance.
methodrich.syntax.Syntax.lexer() -> Optional[Lexer]
The lexer for this syntax, or None if no lexer was found.
funcrich.syntax.Syntax.line_tokenize() -> Iterable[Tuple[Any, str]]
Split tokens to one per line.
funcrich.syntax.Syntax.tokens_to_spans() -> Iterable[Tuple[str, Optional[Style]]]
Convert tokens to spans.
classrich.syntax.SyntaxTheme
Base class for a syntax theme.
methodrich.syntax.SyntaxTheme.get_background_style() -> Style
Get the background color.
methodrich.syntax.SyntaxTheme.get_style_for_token(token_type:TokenType) -> Style
Get a style for a given Pygments token.
classrich.table.Column
Defines a column within a ~Table.
methodrich.table.Column.cells() -> Iterable['RenderableType']
Get all cells in the column, not including header.
methodrich.table.Column.copy() -> 'Column'
Return a copy of this Column.
methodrich.table.Column.flexible() -> bool
Check if this column is flexible.
classrich.table.Row
Information regarding a row.
classrich.table.Table
A console renderable to draw a table.
methodrich.table.Table.add_row(*style:Optional[StyleType]=None, *end_section:bool=False, *renderables:Optional['RenderableType']) -> None
Add a row of renderables.
methodrich.table.Table.add_section() -> None
Add a new section (draw a line after current row).
methodrich.table.Table.expand() -> bool
Setting a non-None self.width implies expand.
methodrich.table.Table.get_row_style(console:'Console', index:int) -> StyleType
Get the current row style.
methodrich.table.Table.grid(*padding:PaddingDimensions=0, *collapse_padding:bool=True, *pad_edge:bool=False, *expand:bool=False, *headers:Union[Column, str]) -> 'Table'
Get a table with no lines, headers, or footer.

この情報について

掲載しているシグネチャは Textualize/rich の公開ソースコードを Python の ast モジュールで静的解析し、引数名・デフォルト値・ 型注釈・戻り値型をそのまま抽出したものです。実装コードは保存していません。 詳しくは仕組みの解説をご覧ください。

収録ライブラリ一覧(全 805 件)へ戻る