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

Public Member Functions

int cell_length (self)
 
Result __rich_repr__ (self)
 
bool __bool__ (self)
 
bool is_control (self)
 
Tuple["Segment", "Segment"] split_cells (self, int cut)
 
"Segment" line (cls)
 
Iterable["Segment"] apply_style (cls, Iterable["Segment"] segments, Optional[Style] style=None, Optional[Style] post_style=None)
 
Iterable["Segment"] filter_control (cls, Iterable["Segment"] segments, bool is_control=False)
 
Iterable[List["Segment"]] split_lines (cls, Iterable["Segment"] segments)
 
Iterable[List["Segment"]] split_and_crop_lines (cls, Iterable["Segment"] segments, int length, Optional[Style] style=None, bool pad=True, bool include_new_lines=True)
 
List["Segment"] adjust_line_length (cls, List["Segment"] line, int length, Optional[Style] style=None, bool pad=True)
 
int get_line_length (cls, List["Segment"] line)
 
Tuple[int, int] get_shape (cls, List[List["Segment"]] lines)
 
List[List["Segment"]] set_shape (cls, List[List["Segment"]] lines, int width, Optional[int] height=None, Optional[Style] style=None, bool new_lines=False)
 
List[List["Segment"]] align_top (Type["Segment"] cls, List[List["Segment"]] lines, int width, int height, Style style, bool new_lines=False)
 
List[List["Segment"]] align_bottom (Type["Segment"] cls, List[List["Segment"]] lines, int width, int height, Style style, bool new_lines=False)
 
List[List["Segment"]] align_middle (Type["Segment"] cls, List[List["Segment"]] lines, int width, int height, Style style, bool new_lines=False)
 
Iterable["Segment"] simplify (cls, Iterable["Segment"] segments)
 
Iterable["Segment"] strip_links (cls, Iterable["Segment"] segments)
 
Iterable["Segment"] strip_styles (cls, Iterable["Segment"] segments)
 
Iterable["Segment"] remove_color (cls, Iterable["Segment"] segments)
 
Iterable[List["Segment"]] divide (cls, Iterable["Segment"] segments, Iterable[int] cuts)
 

Public Attributes

 text
 

Static Public Attributes

str text
 
Optional style = None
 
Optional control = None
 

Protected Member Functions

Tuple["Segment", "Segment"] _split_cells (cls, "Segment" segment, int cut)
 

Detailed Description

A piece of text with associated style. Segments are produced by the Console render process and
are ultimately converted in to strings to be written to the terminal.

Args:
    text (str): A piece of text.
    style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.
    control (Tuple[ControlCode], optional): Optional sequence of control codes.

Attributes:
    cell_length (int): The cell length of this Segment.

Member Function Documentation

◆ __bool__()

bool pip._vendor.rich.segment.Segment.__bool__ (   self)
Check if the segment contains text.

◆ adjust_line_length()

List["Segment"] pip._vendor.rich.segment.Segment.adjust_line_length (   cls,
List["Segment"]  line,
int  length,
Optional[Style]   style = None,
bool   pad = True 
)
Adjust a line to a given width (cropping or padding as required).

Args:
    segments (Iterable[Segment]): A list of segments in a single line.
    length (int): The desired width of the line.
    style (Style, optional): The style of padding if used (space on the end). Defaults to None.
    pad (bool, optional): Pad lines with spaces if they are shorter than `length`. Defaults to True.

Returns:
    List[Segment]: A line of segments with the desired length.

◆ align_bottom()

List[List["Segment"]] pip._vendor.rich.segment.Segment.align_bottom ( Type["Segment"]  cls,
List[List["Segment"]]  lines,
int  width,
int  height,
Style  style,
bool   new_lines = False 
)
Aligns render to bottom (adds extra lines above as required).

Args:
    lines (List[List[Segment]]): A list of lines.
    width (int): Desired width.
    height (int, optional): Desired height or None for no change.
    style (Style): Style of any padding added. Defaults to None.
    new_lines (bool, optional): Padded lines should include "\n". Defaults to False.

Returns:
    List[List[Segment]]: New list of lines.

◆ align_middle()

List[List["Segment"]] pip._vendor.rich.segment.Segment.align_middle ( Type["Segment"]  cls,
List[List["Segment"]]  lines,
int  width,
int  height,
Style  style,
bool   new_lines = False 
)
Aligns lines to middle (adds extra lines to above and below as required).

Args:
    lines (List[List[Segment]]): A list of lines.
    width (int): Desired width.
    height (int, optional): Desired height or None for no change.
    style (Style): Style of any padding added.
    new_lines (bool, optional): Padded lines should include "\n". Defaults to False.

Returns:
    List[List[Segment]]: New list of lines.

◆ align_top()

List[List["Segment"]] pip._vendor.rich.segment.Segment.align_top ( Type["Segment"]  cls,
List[List["Segment"]]  lines,
int  width,
int  height,
Style  style,
bool   new_lines = False 
)
Aligns lines to top (adds extra lines to bottom as required).

Args:
    lines (List[List[Segment]]): A list of lines.
    width (int): Desired width.
    height (int, optional): Desired height or None for no change.
    style (Style): Style of any padding added.
    new_lines (bool, optional): Padded lines should include "\n". Defaults to False.

Returns:
    List[List[Segment]]: New list of lines.

◆ apply_style()

Iterable["Segment"] pip._vendor.rich.segment.Segment.apply_style (   cls,
Iterable["Segment"]  segments,
Optional[Style]   style = None,
Optional[Style]   post_style = None 
)
Apply style(s) to an iterable of segments.

Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.

Args:
    segments (Iterable[Segment]): Segments to process.
    style (Style, optional): Base style. Defaults to None.
    post_style (Style, optional): Style to apply on top of segment style. Defaults to None.

Returns:
    Iterable[Segments]: A new iterable of segments (possibly the same iterable).

◆ cell_length()

int pip._vendor.rich.segment.Segment.cell_length (   self)
The number of terminal cells required to display self.text.

Returns:
    int: A number of cells.

◆ divide()

Iterable[List["Segment"]] pip._vendor.rich.segment.Segment.divide (   cls,
Iterable["Segment"]  segments,
Iterable[int]   cuts 
)
Divides an iterable of segments in to portions.

Args:
    cuts (Iterable[int]): Cell positions where to divide.

Yields:
    [Iterable[List[Segment]]]: An iterable of Segments in List.

◆ filter_control()

Iterable["Segment"] pip._vendor.rich.segment.Segment.filter_control (   cls,
Iterable["Segment"]  segments,
bool   is_control = False 
)
Filter segments by ``is_control`` attribute.

Args:
    segments (Iterable[Segment]): An iterable of Segment instances.
    is_control (bool, optional): is_control flag to match in search.

Returns:
    Iterable[Segment]: And iterable of Segment instances.

◆ get_line_length()

int pip._vendor.rich.segment.Segment.get_line_length (   cls,
List["Segment"]  line 
)
Get the length of list of segments.

Args:
    line (List[Segment]): A line encoded as a list of Segments (assumes no '\\\\n' characters),

Returns:
    int: The length of the line.

◆ get_shape()

Tuple[int, int] pip._vendor.rich.segment.Segment.get_shape (   cls,
List[List["Segment"]]  lines 
)
Get the shape (enclosing rectangle) of a list of lines.

Args:
    lines (List[List[Segment]]): A list of lines (no '\\\\n' characters).

Returns:
    Tuple[int, int]: Width and height in characters.

◆ is_control()

bool pip._vendor.rich.segment.Segment.is_control (   self)
Check if the segment contains control codes.

◆ line()

"Segment" pip._vendor.rich.segment.Segment.line (   cls)
Make a new line segment.

◆ remove_color()

Iterable["Segment"] pip._vendor.rich.segment.Segment.remove_color (   cls,
Iterable["Segment"]  segments 
)
Remove all color from an iterable of segments.

Args:
    segments (Iterable[Segment]): An iterable segments.

Yields:
    Segment: Segments with colorless style.

◆ set_shape()

List[List["Segment"]] pip._vendor.rich.segment.Segment.set_shape (   cls,
List[List["Segment"]]  lines,
int  width,
Optional[int]   height = None,
Optional[Style]   style = None,
bool   new_lines = False 
)
Set the shape of a list of lines (enclosing rectangle).

Args:
    lines (List[List[Segment]]): A list of lines.
    width (int): Desired width.
    height (int, optional): Desired height or None for no change.
    style (Style, optional): Style of any padding added.
    new_lines (bool, optional): Padded lines should include "\n". Defaults to False.

Returns:
    List[List[Segment]]: New list of lines.

◆ simplify()

Iterable["Segment"] pip._vendor.rich.segment.Segment.simplify (   cls,
Iterable["Segment"]  segments 
)
Simplify an iterable of segments by combining contiguous segments with the same style.

Args:
    segments (Iterable[Segment]): An iterable of segments.

Returns:
    Iterable[Segment]: A possibly smaller iterable of segments that will render the same way.

◆ split_and_crop_lines()

Iterable[List["Segment"]] pip._vendor.rich.segment.Segment.split_and_crop_lines (   cls,
Iterable["Segment"]  segments,
int  length,
Optional[Style]   style = None,
bool   pad = True,
bool   include_new_lines = True 
)
Split segments in to lines, and crop lines greater than a given length.

Args:
    segments (Iterable[Segment]): An iterable of segments, probably
        generated from console.render.
    length (int): Desired line length.
    style (Style, optional): Style to use for any padding.
    pad (bool): Enable padding of lines that are less than `length`.

Returns:
    Iterable[List[Segment]]: An iterable of lines of segments.

◆ split_cells()

Tuple["Segment", "Segment"] pip._vendor.rich.segment.Segment.split_cells (   self,
int  cut 
)
Split segment in to two segments at the specified column.

If the cut point falls in the middle of a 2-cell wide character then it is replaced
by two spaces, to preserve the display width of the parent segment.

Returns:
    Tuple[Segment, Segment]: Two segments.

◆ split_lines()

Iterable[List["Segment"]] pip._vendor.rich.segment.Segment.split_lines (   cls,
Iterable["Segment"]  segments 
)
Split a sequence of segments in to a list of lines.

Args:
    segments (Iterable[Segment]): Segments potentially containing line feeds.

Yields:
    Iterable[List[Segment]]: Iterable of segment lists, one per line.

◆ strip_links()

Iterable["Segment"] pip._vendor.rich.segment.Segment.strip_links (   cls,
Iterable["Segment"]  segments 
)
Remove all links from an iterable of styles.

Args:
    segments (Iterable[Segment]): An iterable segments.

Yields:
    Segment: Segments with link removed.

◆ strip_styles()

Iterable["Segment"] pip._vendor.rich.segment.Segment.strip_styles (   cls,
Iterable["Segment"]  segments 
)
Remove all styles from an iterable of segments.

Args:
    segments (Iterable[Segment]): An iterable segments.

Yields:
    Segment: Segments with styles replace with None

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