1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-11-18 06:11:49 -05:00

Fixed some pep8 errors

This commit is contained in:
Hemna 2021-12-03 09:10:33 -05:00
parent 1233137caf
commit b5b286e75c

View File

@ -51,7 +51,7 @@ class APRSDRichLogRender(LogRender):
if self.show_time: if self.show_time:
output.add_column(style="log.time") output.add_column(style="log.time")
if self.show_thread: if self.show_thread:
rgb = str(utils.rgb_from_name(thread_name)).replace(" ","") rgb = str(utils.rgb_from_name(thread_name)).replace(" ", "")
output.add_column(style=f"rgb{rgb}", width=self.thread_width) output.add_column(style=f"rgb{rgb}", width=self.thread_width)
if self.show_level: if self.show_level:
output.add_column(style="log.level", width=self.level_width) output.add_column(style="log.level", width=self.level_width)
@ -123,40 +123,38 @@ class APRSDRichHandler(RichHandler):
) )
def render( def render(
self, self, *, record: LogRecord,
*, traceback: Optional[Traceback],
record: LogRecord, message_renderable: "ConsoleRenderable",
traceback: Optional[Traceback],
message_renderable: "ConsoleRenderable",
) -> "ConsoleRenderable": ) -> "ConsoleRenderable":
"""Render log for display. """Render log for display.
Args: Args:
record (LogRecord): logging Record. record (LogRecord): logging Record.
traceback (Optional[Traceback]): Traceback instance or None for no Traceback. traceback (Optional[Traceback]): Traceback instance or None for no Traceback.
message_renderable (ConsoleRenderable): Renderable (typically Text) containing log message contents. message_renderable (ConsoleRenderable): Renderable (typically Text) containing log message contents.
Returns: Returns:
ConsoleRenderable: Renderable to display log. ConsoleRenderable: Renderable to display log.
""" """
path = Path(record.pathname).name path = Path(record.pathname).name
level = self.get_level_text(record) level = self.get_level_text(record)
time_format = None if self.formatter is None else self.formatter.datefmt time_format = None if self.formatter is None else self.formatter.datefmt
log_time = datetime.fromtimestamp(record.created) log_time = datetime.fromtimestamp(record.created)
thread_name = record.threadName thread_name = record.threadName
log_renderable = self._log_render( log_renderable = self._log_render(
self.console, self.console,
[message_renderable] if not traceback else [ [message_renderable] if not traceback else [
message_renderable, message_renderable,
traceback, traceback,
], ],
log_time=log_time, log_time=log_time,
time_format=time_format, time_format=time_format,
level=level, level=level,
path=path, path=path,
line_no=record.lineno, line_no=record.lineno,
link_path=record.pathname if self.enable_link_path else None, link_path=record.pathname if self.enable_link_path else None,
thread_name=thread_name, thread_name=thread_name,
) )
return log_renderable return log_renderable