Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
RichPipStreamHandler Class Reference
Inheritance diagram for RichPipStreamHandler:
Collaboration diagram for RichPipStreamHandler:

Public Member Functions

None __init__ (self, Optional[TextIO] stream, bool no_color)
 
None emit (self, logging.LogRecord record)
 
None handleError (self, logging.LogRecord record)
 
- Public Member Functions inherited from RichHandler
Text get_level_text (self, LogRecord record)
 
"ConsoleRenderable" render_message (self, LogRecord record, str message)
 
"ConsoleRenderable" render (self, *LogRecord record, Optional[Traceback] traceback, "ConsoleRenderable" message_renderable)
 

Static Public Attributes

list KEYWORDS = []
 
- Static Public Attributes inherited from RichHandler
list KEYWORDS
 
ClassVar HIGHLIGHTER_CLASS = ReprHighlighter
 

Additional Inherited Members

- Data Fields inherited from RichHandler
 console
 
 highlighter
 
 enable_link_path
 
 markup
 
 rich_tracebacks
 
 tracebacks_width
 
 tracebacks_extra_lines
 
 tracebacks_theme
 
 tracebacks_word_wrap
 
 tracebacks_show_locals
 
 tracebacks_suppress
 
 locals_max_length
 
 locals_max_string
 
 keywords
 
- Protected Attributes inherited from RichHandler
 _log_render
 

Detailed Description

Definition at line 140 of file logging.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ (   self,
Optional[TextIO]  stream,
bool  no_color 
)

Reimplemented from RichHandler.

Definition at line 143 of file logging.py.

143 def __init__(self, stream: Optional[TextIO], no_color: bool) -> None:
144 super().__init__(
145 console=Console(file=stream, no_color=no_color, soft_wrap=True),
146 show_time=False,
147 show_level=False,
148 show_path=False,
149 highlighter=NullHighlighter(),
150 )
151
for i

References RichPipStreamHandler.__init__(), and i.

Referenced by RichPipStreamHandler.__init__(), and Protocol.__init_subclass__().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ emit()

None emit (   self,
logging.LogRecord  record 
)
Invoked by logging.

Reimplemented from RichHandler.

Definition at line 153 of file logging.py.

153 def emit(self, record: logging.LogRecord) -> None:
154 style: Optional[Style] = None
155
156 # If we are given a diagnostic error to present, present it with indentation.
157 assert isinstance(record.args, tuple)
158 if record.msg == "[present-rich] %s" and len(record.args) == 1:
159 rich_renderable = record.args[0]
160 assert isinstance(
161 rich_renderable, (ConsoleRenderable, RichCast, str)
162 ), f"{rich_renderable} is not rich-console-renderable"
163
164 renderable: RenderableType = IndentedRenderable(
165 rich_renderable, indent=get_indentation()
166 )
167 else:
168 message = self.format(record)
169 renderable = self.render_message(record, message)
170 if record.levelno is not None:
172 style = Style(color="red")
174 style = Style(color="yellow")
175
176 try:
177 self.console.print(renderable, overflow="ignore", crop=False, style=style)
178 except Exception:
179 self.handleError(record)
180

References ThemeContext.console, ScreenContext.console, Live.console, RichHandler.console, Progress.console(), PromptBase.console, Status.console(), IndentingFormatter.format(), Formatter.format(), ImageFormatter.format(), NullFormatter.format(), RawTokenFormatter.format(), TestcaseFormatter.format(), TerminalFormatter.format(), Terminal256Formatter.format(), pip._internal.utils.logging.get_indentation(), RichPipStreamHandler.handleError(), i, and RichHandler.render_message().

Here is the call graph for this function:

◆ handleError()

None handleError (   self,
logging.LogRecord  record 
)
Called when logging is unable to log some output.

Definition at line 181 of file logging.py.

181 def handleError(self, record: logging.LogRecord) -> None:
182 """Called when logging is unable to log some output."""
183
184 exc_class, exc = sys.exc_info()[:2]
185 # If a broken pipe occurred while calling write() or flush() on the
186 # stdout stream in logging's Handler.emit(), then raise our special
187 # exception so we can handle it in main() instead of logging the
188 # broken pipe error and continuing.
189 if (
190 exc_class
191 and exc
192 and self.console.file is sys.stdout
193 and _is_broken_pipe_error(exc_class, exc)
194 ):
195 raise BrokenStdoutLoggingError()
196
197 return super().handleError(record)
198
199

References pip._internal.utils.logging._is_broken_pipe_error(), ThemeContext.console, ScreenContext.console, Live.console, RichHandler.console, Progress.console(), PromptBase.console, Status.console(), RichPipStreamHandler.handleError(), and i.

Referenced by RichPipStreamHandler.emit(), RichHandler.emit(), and RichPipStreamHandler.handleError().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ KEYWORDS

list KEYWORDS = []
static

Definition at line 141 of file logging.py.

Referenced by RichHandler.render_message().


The documentation for this class was generated from the following file: