mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-06 05:55:42 +00:00
nem sei pq tantos arquivos
This commit is contained in:
@@ -137,12 +137,19 @@ class IndentedRenderable:
|
||||
yield Segment("\n")
|
||||
|
||||
|
||||
class PipConsole(Console):
|
||||
def on_broken_pipe(self) -> None:
|
||||
# Reraise the original exception, rich 13.8.0+ exits by default
|
||||
# instead, preventing our handler from firing.
|
||||
raise BrokenPipeError() from None
|
||||
|
||||
|
||||
class RichPipStreamHandler(RichHandler):
|
||||
KEYWORDS: ClassVar[Optional[List[str]]] = []
|
||||
|
||||
def __init__(self, stream: Optional[TextIO], no_color: bool) -> None:
|
||||
super().__init__(
|
||||
console=Console(file=stream, no_color=no_color, soft_wrap=True),
|
||||
console=PipConsole(file=stream, no_color=no_color, soft_wrap=True),
|
||||
show_time=False,
|
||||
show_level=False,
|
||||
show_path=False,
|
||||
@@ -154,9 +161,9 @@ class RichPipStreamHandler(RichHandler):
|
||||
style: Optional[Style] = None
|
||||
|
||||
# If we are given a diagnostic error to present, present it with indentation.
|
||||
assert isinstance(record.args, tuple)
|
||||
if record.msg == "[present-rich] %s" and len(record.args) == 1:
|
||||
rich_renderable = record.args[0]
|
||||
if getattr(record, "rich", False):
|
||||
assert isinstance(record.args, tuple)
|
||||
(rich_renderable,) = record.args
|
||||
assert isinstance(
|
||||
rich_renderable, (ConsoleRenderable, RichCast, str)
|
||||
), f"{rich_renderable} is not rich-console-renderable"
|
||||
@@ -212,7 +219,6 @@ class MaxLevelFilter(Filter):
|
||||
|
||||
|
||||
class ExcludeLoggerFilter(Filter):
|
||||
|
||||
"""
|
||||
A logging Filter that excludes records from a logger (or its children).
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user