Skip to content

Commit 9f620dc

Browse files
authored
Merge pull request #3191 from Textualize/assorted-docs-and-tidying
Various docstring fixes, removing unused variables
2 parents 238cf7b + cb211d5 commit 9f620dc

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

Diff for: rich/containers.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from itertools import zip_longest
22
from typing import (
3-
Iterator,
3+
TYPE_CHECKING,
44
Iterable,
5+
Iterator,
56
List,
67
Optional,
8+
TypeVar,
79
Union,
810
overload,
9-
TypeVar,
10-
TYPE_CHECKING,
1111
)
1212

1313
if TYPE_CHECKING:
@@ -119,7 +119,7 @@ def justify(
119119
120120
Args:
121121
console (Console): Console instance.
122-
width (int): Number of characters per line.
122+
width (int): Number of cells available per line.
123123
justify (str, optional): Default justify method for text: "left", "center", "full" or "right". Defaults to "left".
124124
overflow (str, optional): Default overflow for text: "crop", "fold", or "ellipsis". Defaults to "fold".
125125

Diff for: rich/markup.py

+3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ def render(
113113
114114
Args:
115115
markup (str): A string containing console markup.
116+
style: (Union[str, Style]): The style to use.
116117
emoji (bool, optional): Also render emoji code. Defaults to True.
118+
emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
119+
117120
118121
Raises:
119122
MarkupError: If there is a syntax error in the markup.

Diff for: rich/text.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,9 @@ def from_markup(
271271
272272
Args:
273273
text (str): A string containing console markup.
274+
style (Union[str, Style], optional): Base style for text. Defaults to "".
274275
emoji (bool, optional): Also render emoji code. Defaults to True.
276+
emoji_variant (str, optional): Optional emoji variant, either "text" or "emoji". Defaults to None.
275277
justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
276278
overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
277279
end (str, optional): Character to end text with. Defaults to "\\\\n".
@@ -369,6 +371,7 @@ def assemble(
369371
style (Union[str, Style], optional): Base style for text. Defaults to "".
370372
justify (str, optional): Justify method: "left", "center", "full", "right". Defaults to None.
371373
overflow (str, optional): Overflow method: "crop", "fold", "ellipsis". Defaults to None.
374+
no_wrap (bool, optional): Disable text wrapping, or None for default. Defaults to None.
372375
end (str, optional): Character to end text with. Defaults to "\\\\n".
373376
tab_size (int): Number of spaces per tab, or ``None`` to use ``console.tab_size``. Defaults to None.
374377
meta (Dict[str, Any], optional). Meta data to apply to text, or None for no meta data. Default to None
@@ -424,7 +427,7 @@ def spans(self, spans: List[Span]) -> None:
424427
self._spans = spans[:]
425428

426429
def blank_copy(self, plain: str = "") -> "Text":
427-
"""Return a new Text instance with copied meta data (but not the string or spans)."""
430+
"""Return a new Text instance with copied metadata (but not the string or spans)."""
428431
copy_self = Text(
429432
plain,
430433
style=self.style,
@@ -505,7 +508,7 @@ def stylize_before(
505508
def apply_meta(
506509
self, meta: Dict[str, Any], start: int = 0, end: Optional[int] = None
507510
) -> None:
508-
"""Apply meta data to the text, or a portion of the text.
511+
"""Apply metadata to the text, or a portion of the text.
509512
510513
Args:
511514
meta (Dict[str, Any]): A dict of meta information.
@@ -634,9 +637,9 @@ def highlight_words(
634637
"""Highlight words with a style.
635638
636639
Args:
637-
words (Iterable[str]): Worlds to highlight.
640+
words (Iterable[str]): Words to highlight.
638641
style (Union[str, Style]): Style to apply.
639-
case_sensitive (bool, optional): Enable case sensitive matchings. Defaults to True.
642+
case_sensitive (bool, optional): Enable case sensitive matching. Defaults to True.
640643
641644
Returns:
642645
int: Number of words highlighted.
@@ -823,8 +826,6 @@ def expand_tabs(self, tab_size: Optional[int] = None) -> None:
823826
if tab_size is None:
824827
tab_size = 8
825828

826-
result = self.blank_copy()
827-
828829
new_text: List[Text] = []
829830
append = new_text.append
830831

@@ -899,6 +900,7 @@ def pad(self, count: int, character: str = " ") -> None:
899900
900901
Args:
901902
count (int): Width of padding.
903+
character (str): The character to pad with. Must be a string of length 1.
902904
"""
903905
assert len(character) == 1, "Character must be a string of length 1"
904906
if count:
@@ -1005,6 +1007,9 @@ def append_text(self, text: "Text") -> "Text":
10051007
"""Append another Text instance. This method is more performant that Text.append, but
10061008
only works for Text.
10071009
1010+
Args:
1011+
text (Text): The Text instance to append to this instance.
1012+
10081013
Returns:
10091014
Text: Returns self for chaining.
10101015
"""
@@ -1026,7 +1031,7 @@ def append_tokens(
10261031
"""Append iterable of str and style. Style may be a Style instance or a str style definition.
10271032
10281033
Args:
1029-
pairs (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style.
1034+
tokens (Iterable[Tuple[str, Optional[StyleType]]]): An iterable of tuples containing str content and style.
10301035
10311036
Returns:
10321037
Text: Returns self for chaining.
@@ -1204,8 +1209,7 @@ def wrap(
12041209
12051210
Args:
12061211
console (Console): Console instance.
1207-
width (int): Number of characters per line.
1208-
emoji (bool, optional): Also render emoji code. Defaults to True.
1212+
width (int): Number of cells available per line.
12091213
justify (str, optional): Justify method: "default", "left", "center", "full", "right". Defaults to "default".
12101214
overflow (str, optional): Overflow method: "crop", "fold", or "ellipsis". Defaults to None.
12111215
tab_size (int, optional): Default tab size. Defaults to 8.

0 commit comments

Comments
 (0)