From 253b80740a1b0e9b0764d6dbdb37d4d12464997d Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 16 Apr 2022 15:38:34 -0700 Subject: [PATCH] clean up linting and format --- jrnl/jrnl.py | 4 ++-- jrnl/output.py | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index f93f4deb..2902c523 100644 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -300,7 +300,7 @@ def _print_edited_summary(journal, old_stats, **kwargs): if stats["deleted"] > 0: my_msg = ( MsgText.JournalCountDeletedSingular - if stats["added"] == 1 + if stats["deleted"] == 1 else MsgText.JournalCountDeletedPlural ) msgs.append(Message(my_msg, MsgType.NORMAL, {"num": stats["deleted"]})) @@ -308,7 +308,7 @@ def _print_edited_summary(journal, old_stats, **kwargs): if stats["modified"] > 0: my_msg = ( MsgText.JournalCountModifiedSingular - if stats["added"] == 1 + if stats["modified"] == 1 else MsgText.JournalCountModifiedPlural ) msgs.append(Message(my_msg, MsgType.NORMAL, {"num": stats["modified"]})) diff --git a/jrnl/output.py b/jrnl/output.py index b32e4dda..c1ebfa40 100644 --- a/jrnl/output.py +++ b/jrnl/output.py @@ -4,18 +4,12 @@ import logging import sys import textwrap -from typing import Tuple from rich import print -import rich from rich.panel import Panel -from rich.padding import Padding from rich.text import Text -from rich.measure import Measurement -from rich.console import Group from rich import box -from jrnl.color import colorize from jrnl.color import RESET_COLOR from jrnl.color import WARNING_COLOR from jrnl.messages import Message @@ -61,9 +55,9 @@ def print_msgs(msgs: list[Message], delimiter: str = "\n") -> None: kwargs = { "expand": False, "border_style": None, - "padding": (0,2), + "padding": (0, 2), "title_align": "left", - "box": box.HEAVY + "box": box.HEAVY, } for msg in msgs: @@ -85,10 +79,10 @@ def print_msgs(msgs: list[Message], delimiter: str = "\n") -> None: def is_keyboard_int(msg: Message) -> bool: return msg.text == MsgText.KeyboardInterruptMsg + def format_msg(msg: Message) -> Text: text = ( - textwrap.dedent(msg.text.value.format(**msg.params)) - .strip() + textwrap.dedent(msg.text.value.format(**msg.params)).strip() # .splitlines(keepends=True) ) result = Text(text)