text_a stringlengths 39 2k | text_b stringlengths 2 2k | label float64 0 1 |
|---|---|---|
def panel(
content: Union[str, RenderableType],
*,
title: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.SINGLE,
**kwargs
) -> str:
"""Create and render a panel with the given content."""
return Panel(content, title=title, border_style=border_style, **kwargs).rende... | Create and render a panel with the given content. | 1 |
def panel(
content: Union[str, RenderableType],
*,
title: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.SINGLE,
**kwargs
) -> str:
"""Create and render a panel with the given content."""
return Panel(content, title=title, border_style=border_style, **kwargs).rende... | panel | 0.5 |
def render(self, width: int) -> List[str]:
"""Render the object to a list of strings."""
pass | Render the object to a list of strings. | 1 |
def render(self, width: int) -> List[str]:
"""Render the object to a list of strings."""
pass | render | 0.5 |
def apply_style(self, colors: 'Colors') -> str:
"""Apply styling to the text."""
if not self.style:
return self.text
# Apply color/style logic here
return self.text | Apply styling to the text. | 1 |
def apply_style(self, colors: 'Colors') -> str:
"""Apply styling to the text."""
if not self.style:
return self.text
# Apply color/style logic here
return self.text | apply_style | 0.5 |
def all(cls, value: int) -> 'Padding':
"""Create padding with same value for all sides."""
return cls(value, value, value, value) | Create padding with same value for all sides. | 1 |
def all(cls, value: int) -> 'Padding':
"""Create padding with same value for all sides."""
return cls(value, value, value, value) | all | 0.5 |
def symmetric(cls, vertical: int, horizontal: int) -> 'Padding':
"""Create padding with vertical and horizontal values."""
return cls(vertical, horizontal, vertical, horizontal) | Create padding with vertical and horizontal values. | 1 |
def symmetric(cls, vertical: int, horizontal: int) -> 'Padding':
"""Create padding with vertical and horizontal values."""
return cls(vertical, horizontal, vertical, horizontal) | symmetric | 0.5 |
def from_tuple(cls, values: Tuple[int, ...]) -> 'Padding':
"""Create padding from tuple (top, right, bottom, left) or (vertical, horizontal)."""
if len(values) == 1:
return cls.all(values[0])
elif len(values) == 2:
return cls.symmetric(values[0], values[1])
el... | Create padding from tuple (top, right, bottom, left) or (vertical, horizontal). | 1 |
def from_tuple(cls, values: Tuple[int, ...]) -> 'Padding':
"""Create padding from tuple (top, right, bottom, left) or (vertical, horizontal)."""
if len(values) == 1:
return cls.all(values[0])
elif len(values) == 2:
return cls.symmetric(values[0], values[1])
el... | from_tuple | 0.5 |
def total_vertical(self) -> int:
"""Get total vertical padding."""
return self.top + self.bottom | Get total vertical padding. | 1 |
def total_vertical(self) -> int:
"""Get total vertical padding."""
return self.top + self.bottom | total_vertical | 0.5 |
def total_horizontal(self) -> int:
"""Get total horizontal padding."""
return self.left + self.right | Get total horizontal padding. | 1 |
def total_horizontal(self) -> int:
"""Get total horizontal padding."""
return self.left + self.right | total_horizontal | 0.5 |
def __init__(
self,
content: Union[str, RenderableType] = "",
*,
title: Optional[str] = None,
subtitle: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.SINGLE,
border_color: Optional[str] = None,
title_color: Optional[str] = N... | Initialize an enhanced panel.
Args:
content: The main content to display (string or renderable object)
title: Optional title for the panel (displayed in top border)
subtitle: Optional subtitle for the panel (displayed in bottom border)
border_style: Border style to use (BorderStyle enum or string)
... | 1 |
def __init__(
self,
content: Union[str, RenderableType] = "",
*,
title: Optional[str] = None,
subtitle: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.SINGLE,
border_color: Optional[str] = None,
title_color: Optional[str] = N... | __init__ | 0.5 |
def fit(
cls,
renderable: Union[str, "RenderableType"],
*,
title: Optional[str] = None,
subtitle: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.ROUNDED,
border_color: Optional[str] = None,
padding: Union[Padding, int, Tuple[... | Create a panel that fits the content without expanding.
This is a convenience classmethod that creates a Panel with
expand=False, so the panel will be sized to fit its content.
Args:
renderable: The content to display.
title: Optional title for the panel.
subtitle: Optional subtitle for the panel.
bor... | 1 |
def fit(
cls,
renderable: Union[str, "RenderableType"],
*,
title: Optional[str] = None,
subtitle: Optional[str] = None,
border_style: Union[BorderStyle, str] = BorderStyle.ROUNDED,
border_color: Optional[str] = None,
padding: Union[Padding, int, Tuple[... | fit | 0.5 |
def render(self) -> str:
"""Render the enhanced panel to a string."""
if not self.content and not self.title and not self.subtitle:
return ""
# Handle different content types
if isinstance(self.content, RenderableType):
# For renderable objects, get t... | Render the enhanced panel to a string. | 1 |
def render(self) -> str:
"""Render the enhanced panel to a string."""
if not self.content and not self.title and not self.subtitle:
return ""
# Handle different content types
if isinstance(self.content, RenderableType):
# For renderable objects, get t... | render | 0.5 |
def print(self, *, file=None) -> None:
"""Print the panel to stdout or specified file."""
import sys
if file is None:
file = sys.stdout
print(self.render(), file=file) | Print the panel to stdout or specified file. | 1 |
def print(self, *, file=None) -> None:
"""Print the panel to stdout or specified file."""
import sys
if file is None:
file = sys.stdout
print(self.render(), file=file) | print | 0.5 |
def __init__(
self,
*panels: Panel,
layout: Literal["vertical", "horizontal", "grid"] = "vertical",
spacing: int = 1,
equal_width: bool = False,
equal_height: bool = False,
align: Literal["left", "center", "right"] = "left",
):
"""Initialize a pane... | Initialize a panel group. | 1 |
def __init__(
self,
*panels: Panel,
layout: Literal["vertical", "horizontal", "grid"] = "vertical",
spacing: int = 1,
equal_width: bool = False,
equal_height: bool = False,
align: Literal["left", "center", "right"] = "left",
):
"""Initialize a pane... | __init__ | 0.5 |
def add_panel(self, panel: Panel) -> None:
"""Add a panel to the group."""
self.panels.append(panel) | Add a panel to the group. | 1 |
def add_panel(self, panel: Panel) -> None:
"""Add a panel to the group."""
self.panels.append(panel) | add_panel | 0.5 |
def render(self) -> str:
"""Render all panels in the group."""
if not self.panels:
return ""
if self.layout == "vertical":
return self._render_vertical()
elif self.layout == "horizontal":
return self._render_horizontal()
elif self.... | Render all panels in the group. | 1 |
def render(self) -> str:
"""Render all panels in the group."""
if not self.panels:
return ""
if self.layout == "vertical":
return self._render_vertical()
elif self.layout == "horizontal":
return self._render_horizontal()
elif self.... | render | 0.5 |
def render_segments(segments: Iterable[Segment]) -> str:
"""Render a sequence of segments to a string.
Args:
segments: An iterable of segments.
Returns:
The rendered string with ANSI codes.
"""
return "".join(segment.render() for segment in segments) | Render a sequence of segments to a string.
Args:
segments: An iterable of segments.
Returns:
The rendered string with ANSI codes. | 1 |
def render_segments(segments: Iterable[Segment]) -> str:
"""Render a sequence of segments to a string.
Args:
segments: An iterable of segments.
Returns:
The rendered string with ANSI codes.
"""
return "".join(segment.render() for segment in segments) | render_segments | 0.5 |
def cell_length(self) -> int:
"""Get the cell length of the text (for display purposes)."""
if self.control:
return 0
return len(self.text) | Get the cell length of the text (for display purposes). | 1 |
def cell_length(self) -> int:
"""Get the cell length of the text (for display purposes)."""
if self.control:
return 0
return len(self.text) | cell_length | 0.5 |
def is_control(self) -> bool:
"""Check if this is a control segment."""
return self.control is not None | Check if this is a control segment. | 1 |
def is_control(self) -> bool:
"""Check if this is a control segment."""
return self.control is not None | is_control | 0.5 |
def line(cls) -> "Segment":
"""Create a newline segment."""
return cls("\n") | Create a newline segment. | 1 |
def line(cls) -> "Segment":
"""Create a newline segment."""
return cls("\n") | line | 0.5 |
def control_segment(cls, control_code: ControlCode) -> "Segment":
"""Create a control segment.
Args:
control_code: The control code to embed.
Returns:
A control segment with no visible text.
"""
return cls("", control=control_code... | Create a control segment.
Args:
control_code: The control code to embed.
Returns:
A control segment with no visible text. | 1 |
def control_segment(cls, control_code: ControlCode) -> "Segment":
"""Create a control segment.
Args:
control_code: The control code to embed.
Returns:
A control segment with no visible text.
"""
return cls("", control=control_code... | control_segment | 0.5 |
def apply_style(self, style: Optional[str]) -> "Segment":
"""Apply a style to this segment, combining with existing style.
Args:
style: Style to apply.
Returns:
A new Segment with the combined style.
"""
if not style:
... | Apply a style to this segment, combining with existing style.
Args:
style: Style to apply.
Returns:
A new Segment with the combined style. | 1 |
def apply_style(self, style: Optional[str]) -> "Segment":
"""Apply a style to this segment, combining with existing style.
Args:
style: Style to apply.
Returns:
A new Segment with the combined style.
"""
if not style:
... | apply_style | 0.5 |
def render(self) -> str:
"""Render the segment to an ANSI-formatted string.
Returns:
The text with ANSI escape codes applied.
"""
from .colors import Colors
if self.control:
return self._render_control()
if not self.s... | Render the segment to an ANSI-formatted string.
Returns:
The text with ANSI escape codes applied. | 1 |
def render(self) -> str:
"""Render the segment to an ANSI-formatted string.
Returns:
The text with ANSI escape codes applied.
"""
from .colors import Colors
if self.control:
return self._render_control()
if not self.s... | render | 0.5 |
def strip_styles(cls, segments: Iterable["Segment"]) -> str:
"""Join segments into plain text, stripping all styles.
Args:
segments: An iterable of segments.
Returns:
Plain text without any styling.
"""
return "".join(
... | Join segments into plain text, stripping all styles.
Args:
segments: An iterable of segments.
Returns:
Plain text without any styling. | 1 |
def strip_styles(cls, segments: Iterable["Segment"]) -> str:
"""Join segments into plain text, stripping all styles.
Args:
segments: An iterable of segments.
Returns:
Plain text without any styling.
"""
return "".join(
... | strip_styles | 0.5 |
def strip_links(cls, segments: Iterable["Segment"]) -> Iterator["Segment"]:
"""Remove links from segments (placeholder for future link support).
Args:
segments: An iterable of segments.
Yields:
Segments with links removed.
"""
for... | Remove links from segments (placeholder for future link support).
Args:
segments: An iterable of segments.
Yields:
Segments with links removed. | 1 |
def strip_links(cls, segments: Iterable["Segment"]) -> Iterator["Segment"]:
"""Remove links from segments (placeholder for future link support).
Args:
segments: An iterable of segments.
Yields:
Segments with links removed.
"""
for... | strip_links | 0.5 |
def get_line_length(cls, segments: Iterable["Segment"]) -> int:
"""Get the total cell length of segments.
Args:
segments: An iterable of segments.
Returns:
Total display width of the segments.
"""
return sum(segment.cell_length fo... | Get the total cell length of segments.
Args:
segments: An iterable of segments.
Returns:
Total display width of the segments. | 1 |
def get_line_length(cls, segments: Iterable["Segment"]) -> int:
"""Get the total cell length of segments.
Args:
segments: An iterable of segments.
Returns:
Total display width of the segments.
"""
return sum(segment.cell_length fo... | get_line_length | 0.5 |
def get_shape(cls, segments: List["Segment"]) -> Tuple[int, int]:
"""Get the shape (width, height) of rendered segments.
Args:
segments: List of segments.
Returns:
Tuple of (max_width, number_of_lines).
"""
lines = cls.split_lines... | Get the shape (width, height) of rendered segments.
Args:
segments: List of segments.
Returns:
Tuple of (max_width, number_of_lines). | 1 |
def get_shape(cls, segments: List["Segment"]) -> Tuple[int, int]:
"""Get the shape (width, height) of rendered segments.
Args:
segments: List of segments.
Returns:
Tuple of (max_width, number_of_lines).
"""
lines = cls.split_lines... | get_shape | 0.5 |
def split_lines(cls, segments: Iterable["Segment"]) -> Iterator[List["Segment"]]:
"""Split segments at newline characters.
Args:
segments: An iterable of segments.
Yields:
Lists of segments for each line.
"""
line: List[Segment] =... | Split segments at newline characters.
Args:
segments: An iterable of segments.
Yields:
Lists of segments for each line. | 1 |
def split_lines(cls, segments: Iterable["Segment"]) -> Iterator[List["Segment"]]:
"""Split segments at newline characters.
Args:
segments: An iterable of segments.
Yields:
Lists of segments for each line.
"""
line: List[Segment] =... | split_lines | 0.5 |
def split_and_crop_lines(
cls,
segments: Iterable["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
include_new_lines: bool = True,
) -> Iterator[List["Segment"]]:
"""Split segments into lines and crop/pad to the given length.
... | Split segments into lines and crop/pad to the given length.
Args:
segments: An iterable of segments.
length: Maximum line length.
style: Style for padding.
pad: Whether to pad lines to the given length.
include_new_lines: Whether to append newline segments.
Yields:
Lists of segments for ea... | 1 |
def split_and_crop_lines(
cls,
segments: Iterable["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
include_new_lines: bool = True,
) -> Iterator[List["Segment"]]:
"""Split segments into lines and crop/pad to the given length.
... | split_and_crop_lines | 0.5 |
def crop_line(
cls,
segments: List["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
) -> List["Segment"]:
"""Crop a line of segments to the given length.
Args:
segments: List of segments representing a line.
... | Crop a line of segments to the given length.
Args:
segments: List of segments representing a line.
length: Maximum length.
style: Style for padding.
pad: Whether to pad to length.
Returns:
Cropped list of segments. | 1 |
def crop_line(
cls,
segments: List["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
) -> List["Segment"]:
"""Crop a line of segments to the given length.
Args:
segments: List of segments representing a line.
... | crop_line | 0.5 |
def adjust_line_length(
cls,
line: List["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
) -> List["Segment"]:
"""Adjust a line to the given length.
Args:
line: List of segments.
length: Target length... | Adjust a line to the given length.
Args:
line: List of segments.
length: Target length.
style: Style for padding.
pad: Whether to pad short lines.
Returns:
Adjusted list of segments. | 1 |
def adjust_line_length(
cls,
line: List["Segment"],
length: int,
style: Optional[str] = None,
pad: bool = True,
) -> List["Segment"]:
"""Adjust a line to the given length.
Args:
line: List of segments.
length: Target length... | adjust_line_length | 0.5 |
def align_line(
cls,
line: List["Segment"],
length: int,
align: str = "left",
style: Optional[str] = None,
) -> List["Segment"]:
"""Align a line within the given length.
Args:
line: List of segments.
length: Target length.
... | Align a line within the given length.
Args:
line: List of segments.
length: Target length.
align: Alignment ("left", "center", "right").
style: Style for padding.
Returns:
Aligned list of segments. | 1 |
def align_line(
cls,
line: List["Segment"],
length: int,
align: str = "left",
style: Optional[str] = None,
) -> List["Segment"]:
"""Align a line within the given length.
Args:
line: List of segments.
length: Target length.
... | align_line | 0.5 |
def simplify(cls, segments: Iterable["Segment"]) -> Iterator["Segment"]:
"""Simplify segments by combining adjacent segments with the same style.
Args:
segments: An iterable of segments.
Yields:
Simplified segments.
"""
current_te... | Simplify segments by combining adjacent segments with the same style.
Args:
segments: An iterable of segments.
Yields:
Simplified segments. | 1 |
def simplify(cls, segments: Iterable["Segment"]) -> Iterator["Segment"]:
"""Simplify segments by combining adjacent segments with the same style.
Args:
segments: An iterable of segments.
Yields:
Simplified segments.
"""
current_te... | simplify | 0.5 |
def rgb(r: int, g: int, b: int) -> str:
"""Generate a 24-bit (true color) ANSI color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB color
"""
... | Generate a 24-bit (true color) ANSI color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB color | 1 |
def rgb(r: int, g: int, b: int) -> str:
"""Generate a 24-bit (true color) ANSI color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB color
"""
... | rgb | 0.5 |
def bg_rgb(r: int, g: int, b: int) -> str:
"""Generate a 24-bit (true color) ANSI background color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB background ... | Generate a 24-bit (true color) ANSI background color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB background color | 1 |
def bg_rgb(r: int, g: int, b: int) -> str:
"""Generate a 24-bit (true color) ANSI background color code.
Args:
r: Red component (0-255)
g: Green component (0-255)
b: Blue component (0-255)
Returns:
ANSI escape sequence for the RGB background ... | bg_rgb | 0.5 |
def color256(n: int) -> str:
"""Generate an ANSI color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color
"""
n = max(0, min(255, n))
return f'\033[38;5;{n}m' | Generate an ANSI color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color | 1 |
def color256(n: int) -> str:
"""Generate an ANSI color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color
"""
n = max(0, min(255, n))
return f'\033[38;5;{n}m' | color256 | 0.5 |
def bg_color256(n: int) -> str:
"""Generate an ANSI background color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color background
"""
n = max(0, min(255, n))
return f'\033[48;5;{n}m' | Generate an ANSI background color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color background | 1 |
def bg_color256(n: int) -> str:
"""Generate an ANSI background color code for 256-color terminals.
Args:
n: Color number (0-255)
Returns:
ANSI escape sequence for the 256-color background
"""
n = max(0, min(255, n))
return f'\033[48;5;{n}m' | bg_color256 | 0.5 |
def from_name(cls, name: str) -> str:
"""Get an ANSI color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named color
Raises:
ValueError: If the color name is not recogni... | Get an ANSI color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named color
Raises:
ValueError: If the color name is not recognized | 1 |
def from_name(cls, name: str) -> str:
"""Get an ANSI color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named color
Raises:
ValueError: If the color name is not recogni... | from_name | 0.5 |
def bg_from_name(cls, name: str) -> str:
"""Get an ANSI background color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named background color
Raises:
ValueError: If the ... | Get an ANSI background color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named background color
Raises:
ValueError: If the color name is not recognized | 1 |
def bg_from_name(cls, name: str) -> str:
"""Get an ANSI background color code from a named color.
Args:
name: Color name (e.g., 'red', 'blue', 'lightgreen')
Returns:
ANSI escape sequence for the named background color
Raises:
ValueError: If the ... | bg_from_name | 0.5 |
def from_hex(hex_color: str) -> str:
"""Convert a hex color code to an ANSI color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex color
Raises:
ValueError: If the hex color is invalid
... | Convert a hex color code to an ANSI color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex color
Raises:
ValueError: If the hex color is invalid | 1 |
def from_hex(hex_color: str) -> str:
"""Convert a hex color code to an ANSI color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex color
Raises:
ValueError: If the hex color is invalid
... | from_hex | 0.5 |
def bg_from_hex(hex_color: str) -> str:
"""Convert a hex color code to an ANSI background color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex background color
Raises:
ValueError: If t... | Convert a hex color code to an ANSI background color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex background color
Raises:
ValueError: If the hex color is invalid | 1 |
def bg_from_hex(hex_color: str) -> str:
"""Convert a hex color code to an ANSI background color code.
Args:
hex_color: Hex color code (e.g., '#FF0000', 'FF0000')
Returns:
ANSI escape sequence for the hex background color
Raises:
ValueError: If t... | bg_from_hex | 0.5 |
def parse(cls, color: str) -> str:
"""Parse a color name or hex code and return an ANSI color code.
This helper makes it easy to accept either hex strings like ``"#ff00ff"``
or one of the ``NAMED_COLORS`` entries. The comparison is case
insensitive and the leading ``#`` is optional ... | Parse a color name or hex code and return an ANSI color code.
This helper makes it easy to accept either hex strings like ``"#ff00ff"``
or one of the ``NAMED_COLORS`` entries. The comparison is case
insensitive and the leading ``#`` is optional for hex codes. | 1 |
def parse(cls, color: str) -> str:
"""Parse a color name or hex code and return an ANSI color code.
This helper makes it easy to accept either hex strings like ``"#ff00ff"``
or one of the ``NAMED_COLORS`` entries. The comparison is case
insensitive and the leading ``#`` is optional ... | parse | 0.5 |
def bg_parse(cls, color: str) -> str:
"""Parse a color name or hex code and return an ANSI background code."""
if not color:
raise ValueError("Color value cannot be empty")
color = color.strip()
if re.fullmatch(r"#?[0-9a-fA-F]{3}", color) or re.fullmatch(r"#?[0-9a-fA-F]{... | Parse a color name or hex code and return an ANSI background code. | 1 |
def bg_parse(cls, color: str) -> str:
"""Parse a color name or hex code and return an ANSI background code."""
if not color:
raise ValueError("Color value cannot be empty")
color = color.strip()
if re.fullmatch(r"#?[0-9a-fA-F]{3}", color) or re.fullmatch(r"#?[0-9a-fA-F]{... | bg_parse | 0.5 |
def strip_ansi(text: str) -> str:
"""Remove ANSI escape sequences from a string.
Args:
text: Text containing ANSI escape sequences
Returns:
Text with ANSI escape sequences removed
"""
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')... | Remove ANSI escape sequences from a string.
Args:
text: Text containing ANSI escape sequences
Returns:
Text with ANSI escape sequences removed | 1 |
def strip_ansi(text: str) -> str:
"""Remove ANSI escape sequences from a string.
Args:
text: Text containing ANSI escape sequences
Returns:
Text with ANSI escape sequences removed
"""
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')... | strip_ansi | 0.5 |
def style(text: str, *styles: str) -> str:
"""Apply multiple styles to text.
Args:
text: Text to style
*styles: ANSI style codes to apply
Returns:
Styled text with ANSI escape sequences
"""
if not text:
return ""
retur... | Apply multiple styles to text.
Args:
text: Text to style
*styles: ANSI style codes to apply
Returns:
Styled text with ANSI escape sequences | 1 |
def style(text: str, *styles: str) -> str:
"""Apply multiple styles to text.
Args:
text: Text to style
*styles: ANSI style codes to apply
Returns:
Styled text with ANSI escape sequences
"""
if not text:
return ""
retur... | style | 0.5 |
def gradient(text: str, start_color: Tuple[int, int, int], end_color: Tuple[int, int, int]) -> str:
"""Apply a gradient color effect to text.
Args:
text: Text to apply gradient to
start_color: RGB tuple for starting color
end_color: RGB tuple for ending color
... | Apply a gradient color effect to text.
Args:
text: Text to apply gradient to
start_color: RGB tuple for starting color
end_color: RGB tuple for ending color
Returns:
Text with gradient color effect | 1 |
def gradient(text: str, start_color: Tuple[int, int, int], end_color: Tuple[int, int, int]) -> str:
"""Apply a gradient color effect to text.
Args:
text: Text to apply gradient to
start_color: RGB tuple for starting color
end_color: RGB tuple for ending color
... | gradient | 0.5 |
def rainbow(cls, text: str) -> str:
"""Apply rainbow colors to text.
Args:
text: Text to apply rainbow colors to
Returns:
Text with rainbow colors
"""
if not text:
return ""
rainbow_colors = [
(255, 0, 0), # Red
... | Apply rainbow colors to text.
Args:
text: Text to apply rainbow colors to
Returns:
Text with rainbow colors | 1 |
def rainbow(cls, text: str) -> str:
"""Apply rainbow colors to text.
Args:
text: Text to apply rainbow colors to
Returns:
Text with rainbow colors
"""
if not text:
return ""
rainbow_colors = [
(255, 0, 0), # Red
... | rainbow | 0.5 |
def cprint(
*objects: Iterable,
sep: str = " ",
end: str = "\n",
file=sys.stdout,
flush: bool = False,
) -> None:
"""Print objects with simple Rich-like markup support.
Use syntax like ``[red]error[/red]`` or ``[bold]bold text[/bold]``. Unknown
tags are printed literally.
Also suppo... | Print objects with simple Rich-like markup support.
Use syntax like ``[red]error[/red]`` or ``[bold]bold text[/bold]``. Unknown
tags are printed literally.
Also supports being used as a drop-in replacement for print, including when a slice is passed as an argument. | 1 |
def cprint(
*objects: Iterable,
sep: str = " ",
end: str = "\n",
file=sys.stdout,
flush: bool = False,
) -> None:
"""Print objects with simple Rich-like markup support.
Use syntax like ``[red]error[/red]`` or ``[bold]bold text[/bold]``. Unknown
tags are printed literally.
Also suppo... | cprint | 0.5 |
def print(*args, **kwargs):
"""Alias for cprint, so this module's print behaves like cprint."""
return cprint(*args, **kwargs) | Alias for cprint, so this module's print behaves like cprint. | 1 |
def print(*args, **kwargs):
"""Alias for cprint, so this module's print behaves like cprint."""
return cprint(*args, **kwargs) | print | 0.5 |
def __init__(
self,
*,
color_system: Optional[str] = "auto",
force_terminal: Optional[bool] = None,
no_color: bool = False,
tab_size: int = 8,
record: bool = False,
markup: bool = True,
emoji: bool = True,
highlight: bool = True,
... | Initialize a Console.
Args:
color_system: Color system to use ("auto", "standard", "256", "truecolor", "windows", None).
force_terminal: Force terminal mode.
no_color: Disable all colors.
tab_size: Tab character width.
record: Record all output for later export.
markup: Parse Rich-style markup.... | 1 |
def __init__(
self,
*,
color_system: Optional[str] = "auto",
force_terminal: Optional[bool] = None,
no_color: bool = False,
tab_size: int = 8,
record: bool = False,
markup: bool = True,
emoji: bool = True,
highlight: bool = True,
... | __init__ | 0.5 |
def file(self) -> IO[str]:
"""Get the output file."""
return self._file or sys.stdout | Get the output file. | 1 |
def file(self) -> IO[str]:
"""Get the output file."""
return self._file or sys.stdout | file | 0.5 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- -