Merge branch 'master' of github.com:willmcgugan/rich

This commit is contained in:
Will McGugan 2020-10-08 14:35:18 +01:00
commit 2344cd889d
6 changed files with 15 additions and 13 deletions

View File

@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Change the render prefix to correspond to the decimal units in progress
### Fixed
- Fixed typo in `Style.transparent_background` method name.
## [8.0.0] - 2020-10-03
### Added

View File

@ -620,7 +620,7 @@ class Console:
return ConsoleDimensions(80, 25)
width, height = shutil.get_terminal_size()
# get_terminal_size can report 0, 0 if run from psuedo-terminal
# get_terminal_size can report 0, 0 if run from pseudo-terminal
width = width or 80
height = height or 25
return ConsoleDimensions(
@ -749,7 +749,7 @@ class Console:
is required, such as the Panel class which draws a border around any renderable object.
Args:
renderables (Iterable[RenderableType]): Any object or objects renderable in the console.
renderable (RenderableType): Any object renderable in the console.
options (Optional[ConsoleOptions], optional): Console options, or None to use self.options. Default to ``None``.
style (Style, optional): Optional style to apply to renderables. Defaults to ``None``.
pad (bool, optional): Pad lines shorter than render width. Defaults to ``True``.
@ -858,7 +858,7 @@ class Console:
"""Combined a number of renderables and text in to one renderable.
Args:
renderables (Iterable[Union[str, ConsoleRenderable]]): Anything that Rich can render.
objects (Iterable[Any]): Anything that Rich can render.
sep (str, optional): String to write between print data. Defaults to " ".
end (str, optional): String to write at end of print data. Defaults to "\\n".
justify (str, optional): One of "left", "right", "center", or "full". Defaults to ``None``.
@ -1366,7 +1366,7 @@ class Console:
clear (bool, optional): Clear record buffer after exporting. Defaults to ``True``.
code_format (str, optional): Format string to render HTML, should contain {foreground}
{background} and {code}.
inline_styes (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
inline_styles (bool, optional): If ``True`` styles will be inlined in to spans, which makes files
larger but easier to cut and paste markup. If ``False``, styles will be embedded in a style tag.
Defaults to False.

View File

@ -359,7 +359,7 @@ def pretty_repr(
Args:
_object (Any): Object to repr.
max_width (int, optional): Diresired maximum width of repr string. Defaults to 80.
max_width (int, optional): Desired maximum width of repr string. Defaults to 80.
indent_size (int, optional): Number of spaces to indent. Defaults to 4.
expand_all (bool, optional): Expand all containers regardless of available width. Defaults to False.

View File

@ -345,7 +345,7 @@ class Style:
return self._link
@property
def transaprent_background(self) -> bool:
def transparent_background(self) -> bool:
"""Check if the style specified a transparent background."""
return self.bgcolor is None or self.bgcolor.is_default

View File

@ -353,7 +353,7 @@ class Syntax(JupyterMixin):
base_style = self._get_base_style()
justify: JustifyMethod = (
"default" if base_style.transaprent_background else "left"
"default" if base_style.transparent_background else "left"
)
text = Text(
@ -401,7 +401,7 @@ class Syntax(JupyterMixin):
def _get_number_styles(self, console: Console) -> Tuple[Style, Style, Style]:
"""Get background, number, and highlight styles for line numbers."""
background_style = self._get_base_style()
if background_style.transaprent_background:
if background_style.transparent_background:
return Style.null(), Style(dim=True), Style.null()
if console.color_system in ("256", "truecolor"):
number_style = Style.chain(
@ -428,7 +428,7 @@ class Syntax(JupyterMixin):
def __rich_console__(
self, console: Console, options: ConsoleOptions
) -> RenderResult:
transparent_background = self._get_base_style().transaprent_background
transparent_background = self._get_base_style().transparent_background
code_width = (
(options.max_width - self._numbers_column_width - 1)
if self.code_width is None

View File

@ -9,8 +9,6 @@ from typing import Callable, Dict, List, Optional, Type
from pygments.lexers import guess_lexer_for_filename
from pygments.token import (
Comment,
Generic,
Keyword,
Name,
Number,
@ -212,7 +210,7 @@ class Traceback:
traceback: Optional[TracebackType],
show_locals: bool = False,
) -> Trace:
"""Extrace traceback information.
"""Extract traceback information.
Args:
exc_type (Type[BaseException]): Exception type.
@ -342,7 +340,7 @@ class Traceback:
if syntax_error.filename != "<stdin>":
text = Text.assemble(
(f" {syntax_error.filename}", "pygments.string"),
(":", "pgments.text"),
(":", "pygments.text"),
(str(syntax_error.lineno), "pygments.number"),
style="pygments.text",
)