Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pip._vendor.rich.text.Text Class Reference
Inheritance diagram for pip._vendor.rich.text.Text:
Inheritance graph
[legend]
Collaboration diagram for pip._vendor.rich.text.Text:
Collaboration graph
[legend]

Public Member Functions

None __init__ (self, str text="", Union[str, Style] style="", *Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None, Optional[bool] no_wrap=None, str end="\n", Optional[int] tab_size=8, Optional[List[Span]] spans=None)
 
int __len__ (self)
 
bool __bool__ (self)
 
str __str__ (self)
 
str __repr__ (self)
 
"Text" __add__ (self, Any other)
 
bool __eq__ (self, object other)
 
bool __contains__ (self, object other)
 
"Text" __getitem__ (self, Union[int, slice] slice)
 
int cell_len (self)
 
str markup (self)
 
"Text" from_markup (cls, str text, *Union[str, Style] style="", bool emoji=True, Optional[EmojiVariant] emoji_variant=None, Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None, str end="\n")
 
"Text" from_ansi (cls, str text, *Union[str, Style] style="", Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None, Optional[bool] no_wrap=None, str end="\n", Optional[int] tab_size=8)
 
"Text" styled (cls, str text, StyleType style="", *Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None)
 
"Text" assemble (cls, *Union[str, "Text", Tuple[str, StyleType]] parts, Union[str, Style] style="", Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None, Optional[bool] no_wrap=None, str end="\n", int tab_size=8, Optional[Dict[str, Any]] meta=None)
 
str plain (self)
 
None plain (self, str new_text)
 
List[Spanspans (self)
 
None spans (self, List[Span] spans)
 
"Text" blank_copy (self, str plain="")
 
"Text" copy (self)
 
None stylize (self, Union[str, Style] style, int start=0, Optional[int] end=None)
 
None stylize_before (self, Union[str, Style] style, int start=0, Optional[int] end=None)
 
None apply_meta (self, Dict[str, Any] meta, int start=0, Optional[int] end=None)
 
"Text" on (self, Optional[Dict[str, Any]] meta=None, **Any handlers)
 
None remove_suffix (self, str suffix)
 
Style get_style_at_offset (self, "Console" console, int offset)
 
int highlight_regex (self, str re_highlight, Optional[Union[GetStyleCallable, StyleType]] style=None, *str style_prefix="")
 
int highlight_words (self, Iterable[str] words, Union[str, Style] style, *bool case_sensitive=True)
 
None rstrip (self)
 
None rstrip_end (self, int size)
 
None set_length (self, int new_length)
 
Iterable[Segment__rich_console__ (self, "Console" console, "ConsoleOptions" options)
 
Measurement __rich_measure__ (self, "Console" console, "ConsoleOptions" options)
 
Iterable["Segment"] render (self, "Console" console, str end="")
 
"Text" join (self, Iterable["Text"] lines)
 
None expand_tabs (self, Optional[int] tab_size=None)
 
None truncate (self, int max_width, *Optional["OverflowMethod"] overflow=None, bool pad=False)
 
None pad (self, int count, str character=" ")
 
None pad_left (self, int count, str character=" ")
 
None pad_right (self, int count, str character=" ")
 
None align (self, AlignMethod align, int width, str character=" ")
 
"Text" append (self, Union["Text", str] text, Optional[Union[str, "Style"]] style=None)
 
"Text" append_text (self, "Text" text)
 
"Text" append_tokens (self, Iterable[Tuple[str, Optional[StyleType]]] tokens)
 
None copy_styles (self, "Text" text)
 
Lines split (self, str separator="\n", *bool include_separator=False, bool allow_blank=False)
 
Lines divide (self, Iterable[int] offsets)
 
None right_crop (self, int amount=1)
 
Lines wrap (self, "Console" console, int width, *Optional["JustifyMethod"] justify=None, Optional["OverflowMethod"] overflow=None, int tab_size=8, Optional[bool] no_wrap=None)
 
Lines fit (self, int width)
 
int detect_indentation (self)
 
"Text" with_indent_guides (self, Optional[int] indent_size=None, *str character="│", StyleType style="dim green")
 

Public Attributes

 style
 
 no_wrap
 
 end
 
 tab_size
 
 plain
 

Protected Member Functions

None _trim_spans (self)
 
- Protected Member Functions inherited from pip._vendor.rich.jupyter.JupyterMixin
Dict[str, str] _repr_mimebundle_ ("ConsoleRenderable" self, Sequence[str] include, Sequence[str] exclude, **Any kwargs)
 

Protected Attributes

 _text
 
 _length
 
 _spans
 

Detailed Description

Text with color / style.

Args:
    text (str, optional): Default unstyled text. Defaults to "".
    style (Union[str, Style], optional): Base style for text. Defaults to "".
    justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
    overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
    no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None.
    end (str, optional): Character to end text with. Defaults to "\\\\n".
    tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.
    spans (List[Span], optional). A list of predefined style spans. Defaults to None.

Member Function Documentation

◆ _trim_spans()

None pip._vendor.rich.text.Text._trim_spans (   self)
protected
Remove or modify any spans that are over the end of the text.

◆ align()

None pip._vendor.rich.text.Text.align (   self,
AlignMethod  align,
int  width,
str   character = " " 
)
Align text to a given width.

Args:
    align (AlignMethod): One of "left", "center", or "right".
    width (int): Desired width.
    character (str, optional): Character to pad with. Defaults to " ".

◆ append()

"Text" pip._vendor.rich.text.Text.append (   self,
Union["Text", str]  text,
Optional[Union[str, "Style"]]   style = None 
)
Add text with an optional style.

Args:
    text (Union[Text, str]): A str or Text to append.
    style (str, optional): A style name. Defaults to None.

Returns:
    Text: Returns self for chaining.

◆ append_text()

"Text" pip._vendor.rich.text.Text.append_text (   self,
"Text"  text 
)
Append another Text instance. This method is more performant that Text.append, but
only works for Text.

Returns:
    Text: Returns self for chaining.

◆ append_tokens()

"Text" pip._vendor.rich.text.Text.append_tokens (   self,
Iterable[Tuple[str, Optional[StyleType]]]   tokens 
)
Append iterable of str and style. Style may be a Style instance or a str style definition.

Args:
    pairs (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style.

Returns:
    Text: Returns self for chaining.

◆ apply_meta()

None pip._vendor.rich.text.Text.apply_meta (   self,
Dict[str, Any]  meta,
int   start = 0,
Optional[int]   end = None 
)
Apply meta data to the text, or a portion of the text.

Args:
    meta (Dict[str, Any]): A dict of meta information.
    start (int): Start offset (negative indexing is supported). Defaults to 0.
    end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.

◆ assemble()

"Text" pip._vendor.rich.text.Text.assemble (   cls,
*Union[str, "Text", Tuple[str, StyleType]]  parts,
Union[str, Style]   style = "",
Optional["JustifyMethod"]   justify = None,
Optional["OverflowMethod"]   overflow = None,
Optional[bool]   no_wrap = None,
str   end = "\n",
int   tab_size = 8,
Optional[Dict[str, Any]]   meta = None 
)
Construct a text instance by combining a sequence of strings with optional styles.
The positional arguments should be either strings, or a tuple of string + style.

Args:
    style (Union[str, Style], optional): Base style for text. Defaults to "".
    justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
    overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
    end (str, optional): Character to end text with. Defaults to "\\\\n".
    tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.
    meta (Dict[str, Any], optional). Meta data to apply to text, or None for no meta data. Default to None

Returns:
    Text: A new text instance.

◆ blank_copy()

"Text" pip._vendor.rich.text.Text.blank_copy (   self,
str   plain = "" 
)
Return a new Text instance with copied meta data (but not the string or spans).

◆ cell_len()

int pip._vendor.rich.text.Text.cell_len (   self)
Get the number of cells required to render this text.

◆ copy()

"Text" pip._vendor.rich.text.Text.copy (   self)
Return a copy of this instance.

◆ copy_styles()

None pip._vendor.rich.text.Text.copy_styles (   self,
"Text"  text 
)
Copy styles from another Text instance.

Args:
    text (Text): A Text instance to copy styles from, must be the same length.

◆ detect_indentation()

int pip._vendor.rich.text.Text.detect_indentation (   self)
Auto-detect indentation of code.

Returns:
    int: Number of spaces used to indent code.

◆ divide()

Lines pip._vendor.rich.text.Text.divide (   self,
Iterable[int]  offsets 
)
Divide text in to a number of lines at given offsets.

Args:
    offsets (Iterable[int]): Offsets used to divide text.

Returns:
    Lines: New RichText instances between offsets.

◆ expand_tabs()

None pip._vendor.rich.text.Text.expand_tabs (   self,
Optional[int]   tab_size = None 
)
Converts tabs to spaces.

Args:
    tab_size (int, optional): Size of tabs. Defaults to 8.

◆ fit()

Lines pip._vendor.rich.text.Text.fit (   self,
int  width 
)
Fit the text in to given width by chopping in to lines.

Args:
    width (int): Maximum characters in a line.

Returns:
    Lines: Lines container.

◆ from_ansi()

"Text" pip._vendor.rich.text.Text.from_ansi (   cls,
str  text,
*Union[str, Style]   style = "",
Optional["JustifyMethod"]   justify = None,
Optional["OverflowMethod"]   overflow = None,
Optional[bool]   no_wrap = None,
str   end = "\n",
Optional[int]   tab_size = 8 
)
Create a Text object from a string containing ANSI escape codes.

Args:
    text (str): A string containing escape codes.
    style (Union[str, Style], optional): Base style for text. Defaults to "".
    justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
    overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
    no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None.
    end (str, optional): Character to end text with. Defaults to "\\\\n".
    tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to 8.

◆ from_markup()

"Text" pip._vendor.rich.text.Text.from_markup (   cls,
str  text,
*Union[str, Style]   style = "",
bool   emoji = True,
Optional[EmojiVariant]   emoji_variant = None,
Optional["JustifyMethod"]   justify = None,
Optional["OverflowMethod"]   overflow = None,
str   end = "\n" 
)
Create Text instance from markup.

Args:
    text (str): A string containing console markup.
    emoji (bool, optional): Also render emoji code. Defaults to True.
    justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
    overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
    end (str, optional): Character to end text with. Defaults to "\\\\n".

Returns:
    Text: A Text instance with markup rendered.

◆ get_style_at_offset()

Style pip._vendor.rich.text.Text.get_style_at_offset (   self,
"Console"  console,
int  offset 
)
Get the style of a character at give offset.

Args:
    console (~Console): Console where text will be rendered.
    offset (int): Offset in to text (negative indexing supported)

Returns:
    Style: A Style instance.

◆ highlight_regex()

int pip._vendor.rich.text.Text.highlight_regex (   self,
str  re_highlight,
Optional[Union[GetStyleCallable, StyleType]]   style = None,
*str   style_prefix = "" 
)
Highlight text with a regular expression, where group names are
translated to styles.

Args:
    re_highlight (str): A regular expression.
    style (Union[GetStyleCallable, StyleType]): Optional style to apply to whole match, or a callable
        which accepts the matched text and returns a style. Defaults to None.
    style_prefix (str, optional): Optional prefix to add to style group names.

Returns:
    int: Number of regex matches

◆ highlight_words()

int pip._vendor.rich.text.Text.highlight_words (   self,
Iterable[str]  words,
Union[str, Style style,
*bool   case_sensitive = True 
)
Highlight words with a style.

Args:
    words (Iterable[str]): Worlds to highlight.
    style (Union[str, Style]): Style to apply.
    case_sensitive (bool, optional): Enable case sensitive matchings. Defaults to True.

Returns:
    int: Number of words highlighted.

◆ join()

"Text" pip._vendor.rich.text.Text.join (   self,
Iterable["Text"]  lines 
)
Join text together with this instance as the separator.

Args:
    lines (Iterable[Text]): An iterable of Text instances to join.

Returns:
    Text: A new text instance containing join text.

◆ markup()

str pip._vendor.rich.text.Text.markup (   self)
Get console markup to render this Text.

Returns:
    str: A string potentially creating markup tags.

◆ on()

"Text" pip._vendor.rich.text.Text.on (   self,
Optional[Dict[str, Any]]   meta = None,
**Any  handlers 
)
Apply event handlers (used by Textual project).

Example:
    >>> from rich.text import Text
    >>> text = Text("hello world")
    >>> text.on(click="view.toggle('world')")

Args:
    meta (Dict[str, Any]): Mapping of meta information.
    **handlers: Keyword args are prefixed with "@" to defined handlers.

Returns:
    Text: Self is returned to method may be chained.

◆ pad()

None pip._vendor.rich.text.Text.pad (   self,
int  count,
str   character = " " 
)
Pad left and right with a given number of characters.

Args:
    count (int): Width of padding.

◆ pad_left()

None pip._vendor.rich.text.Text.pad_left (   self,
int  count,
str   character = " " 
)
Pad the left with a given character.

Args:
    count (int): Number of characters to pad.
    character (str, optional): Character to pad with. Defaults to " ".

◆ pad_right()

None pip._vendor.rich.text.Text.pad_right (   self,
int  count,
str   character = " " 
)
Pad the right with a given character.

Args:
    count (int): Number of characters to pad.
    character (str, optional): Character to pad with. Defaults to " ".

◆ plain() [1/2]

str pip._vendor.rich.text.Text.plain (   self)
Get the text as a single string.

◆ plain() [2/2]

None pip._vendor.rich.text.Text.plain (   self,
str  new_text 
)
Set the text to a new value.

◆ remove_suffix()

None pip._vendor.rich.text.Text.remove_suffix (   self,
str  suffix 
)
Remove a suffix if it exists.

Args:
    suffix (str): Suffix to remove.

◆ render()

Iterable["Segment"] pip._vendor.rich.text.Text.render (   self,
"Console"  console,
str   end = "" 
)
Render the text as Segments.

Args:
    console (Console): Console instance.
    end (Optional[str], optional): Optional end character.

Returns:
    Iterable[Segment]: Result of render that may be written to the console.

◆ right_crop()

None pip._vendor.rich.text.Text.right_crop (   self,
int   amount = 1 
)
Remove a number of characters from the end of the text.

◆ rstrip()

None pip._vendor.rich.text.Text.rstrip (   self)
Strip whitespace from end of text.

◆ rstrip_end()

None pip._vendor.rich.text.Text.rstrip_end (   self,
int  size 
)
Remove whitespace beyond a certain width at the end of the text.

Args:
    size (int): The desired size of the text.

◆ set_length()

None pip._vendor.rich.text.Text.set_length (   self,
int  new_length 
)
Set new length of the text, clipping or padding is required.

◆ spans() [1/2]

List[Span] pip._vendor.rich.text.Text.spans (   self)
Get a reference to the internal list of spans.

◆ spans() [2/2]

None pip._vendor.rich.text.Text.spans (   self,
List[Span spans 
)
Set spans.

◆ split()

Lines pip._vendor.rich.text.Text.split (   self,
str   separator = "\n",
*bool   include_separator = False,
bool   allow_blank = False 
)
Split rich text in to lines, preserving styles.

Args:
    separator (str, optional): String to split on. Defaults to "\\\\n".
    include_separator (bool, optional): Include the separator in the lines. Defaults to False.
    allow_blank (bool, optional): Return a blank line if the text ends with a separator. Defaults to False.

Returns:
    List[RichText]: A list of rich text, one per line of the original.

◆ styled()

"Text" pip._vendor.rich.text.Text.styled (   cls,
str  text,
StyleType   style = "",
*Optional["JustifyMethod"]   justify = None,
Optional["OverflowMethod"]   overflow = None 
)
Construct a Text instance with a pre-applied styled. A style applied in this way won't be used
to pad the text when it is justified.

Args:
    text (str): A string containing console markup.
    style (Union[str, Style]): Style to apply to the text. Defaults to "".
    justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
    overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.

Returns:
    Text: A text instance with a style applied to the entire string.

◆ stylize()

None pip._vendor.rich.text.Text.stylize (   self,
Union[str, Style style,
int   start = 0,
Optional[int]   end = None 
)
Apply a style to the text, or a portion of the text.

Args:
    style (Union[str, Style]): Style instance or style definition to apply.
    start (int): Start offset (negative indexing is supported). Defaults to 0.
    end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.

◆ stylize_before()

None pip._vendor.rich.text.Text.stylize_before (   self,
Union[str, Style style,
int   start = 0,
Optional[int]   end = None 
)
Apply a style to the text, or a portion of the text. Styles will be applied before other styles already present.

Args:
    style (Union[str, Style]): Style instance or style definition to apply.
    start (int): Start offset (negative indexing is supported). Defaults to 0.
    end (Optional[int], optional): End offset (negative indexing is supported), or None for end of text. Defaults to None.

◆ truncate()

None pip._vendor.rich.text.Text.truncate (   self,
int  max_width,
*Optional["OverflowMethod"]   overflow = None,
bool   pad = False 
)
Truncate text if it is longer that a given width.

Args:
    max_width (int): Maximum number of characters in text.
    overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None, to use self.overflow.
    pad (bool, optional): Pad with spaces if the length is less than max_width. Defaults to False.

◆ with_indent_guides()

"Text" pip._vendor.rich.text.Text.with_indent_guides (   self,
Optional[int]   indent_size = None,
*str   character = "│",
StyleType   style = "dim green" 
)
Adds indent guide lines to text.

Args:
    indent_size (Optional[int]): Size of indentation, or None to auto detect. Defaults to None.
    character (str, optional): Character to use for indentation. Defaults to "│".
    style (Union[Style, str], optional): Style of indent guides.

Returns:
    Text: New text with indentation guides.

◆ wrap()

Lines pip._vendor.rich.text.Text.wrap (   self,
"Console"  console,
int  width,
*Optional["JustifyMethod"]   justify = None,
Optional["OverflowMethod"]   overflow = None,
int   tab_size = 8,
Optional[bool]   no_wrap = None 
)
Word wrap the text.

Args:
    console (Console): Console instance.
    width (int): Number of characters per line.
    emoji (bool, optional): Also render emoji code. Defaults to True.
    justify (str, optional): Justify method: "default", "left", "center", "full", "right". Defaults to "default".
    overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None.
    tab_size (int, optional): Default tab size. Defaults to 8.
    no_wrap (bool, optional): Disable wrapping, Defaults to False.

Returns:
    Lines: Number of lines.

The documentation for this class was generated from the following file: