mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 18:18:22 +00:00
fix breakage
This commit is contained in:
parent
236e8e8dc3
commit
ea1129af98
2 changed files with 8 additions and 6 deletions
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Fixed exception in Markdown with partial table https://github.com/Textualize/rich/issues/3053
|
||||
- Fixed the HTML export template so that the `<html>` tag comes before the `<head>` tag https://github.com/Textualize/rich/issues/3021
|
||||
- Fixed issue with custom classes overwriting `__eq__` https://github.com/Textualize/rich/issues/2875
|
||||
- Fix rich.pretty.install breakage in iPython https://github.com/Textualize/rich/issues/3013
|
||||
|
||||
### Added
|
||||
|
||||
|
|
|
@ -211,8 +211,11 @@ def install(
|
|||
)
|
||||
builtins._ = value # type: ignore[attr-defined]
|
||||
|
||||
if "get_ipython" in globals():
|
||||
try:
|
||||
ip = get_ipython() # type: ignore[name-defined]
|
||||
except NameError:
|
||||
sys.displayhook = display_hook
|
||||
else:
|
||||
from IPython.core.formatters import BaseFormatter
|
||||
|
||||
class RichFormatter(BaseFormatter): # type: ignore[misc]
|
||||
|
@ -236,8 +239,6 @@ def install(
|
|||
# replace plain text formatter with rich formatter
|
||||
rich_formatter = RichFormatter()
|
||||
ip.display_formatter.formatters["text/plain"] = rich_formatter
|
||||
else:
|
||||
sys.displayhook = display_hook
|
||||
|
||||
|
||||
class Pretty(JupyterMixin):
|
||||
|
@ -708,9 +709,9 @@ def traverse(
|
|||
last=root,
|
||||
)
|
||||
|
||||
def iter_attrs() -> Iterable[
|
||||
Tuple[str, Any, Optional[Callable[[Any], str]]]
|
||||
]:
|
||||
def iter_attrs() -> (
|
||||
Iterable[Tuple[str, Any, Optional[Callable[[Any], str]]]]
|
||||
):
|
||||
"""Iterate over attr fields and values."""
|
||||
for attr in attr_fields:
|
||||
if attr.repr:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue