mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +02:00
clean up linting and format
This commit is contained in:
parent
4b9fe0cd4f
commit
253b80740a
2 changed files with 6 additions and 12 deletions
|
@ -300,7 +300,7 @@ def _print_edited_summary(journal, old_stats, **kwargs):
|
||||||
if stats["deleted"] > 0:
|
if stats["deleted"] > 0:
|
||||||
my_msg = (
|
my_msg = (
|
||||||
MsgText.JournalCountDeletedSingular
|
MsgText.JournalCountDeletedSingular
|
||||||
if stats["added"] == 1
|
if stats["deleted"] == 1
|
||||||
else MsgText.JournalCountDeletedPlural
|
else MsgText.JournalCountDeletedPlural
|
||||||
)
|
)
|
||||||
msgs.append(Message(my_msg, MsgType.NORMAL, {"num": stats["deleted"]}))
|
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:
|
if stats["modified"] > 0:
|
||||||
my_msg = (
|
my_msg = (
|
||||||
MsgText.JournalCountModifiedSingular
|
MsgText.JournalCountModifiedSingular
|
||||||
if stats["added"] == 1
|
if stats["modified"] == 1
|
||||||
else MsgText.JournalCountModifiedPlural
|
else MsgText.JournalCountModifiedPlural
|
||||||
)
|
)
|
||||||
msgs.append(Message(my_msg, MsgType.NORMAL, {"num": stats["modified"]}))
|
msgs.append(Message(my_msg, MsgType.NORMAL, {"num": stats["modified"]}))
|
||||||
|
|
|
@ -4,18 +4,12 @@
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
from typing import Tuple
|
|
||||||
|
|
||||||
from rich import print
|
from rich import print
|
||||||
import rich
|
|
||||||
from rich.panel import Panel
|
from rich.panel import Panel
|
||||||
from rich.padding import Padding
|
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
from rich.measure import Measurement
|
|
||||||
from rich.console import Group
|
|
||||||
from rich import box
|
from rich import box
|
||||||
|
|
||||||
from jrnl.color import colorize
|
|
||||||
from jrnl.color import RESET_COLOR
|
from jrnl.color import RESET_COLOR
|
||||||
from jrnl.color import WARNING_COLOR
|
from jrnl.color import WARNING_COLOR
|
||||||
from jrnl.messages import Message
|
from jrnl.messages import Message
|
||||||
|
@ -61,9 +55,9 @@ def print_msgs(msgs: list[Message], delimiter: str = "\n") -> None:
|
||||||
kwargs = {
|
kwargs = {
|
||||||
"expand": False,
|
"expand": False,
|
||||||
"border_style": None,
|
"border_style": None,
|
||||||
"padding": (0,2),
|
"padding": (0, 2),
|
||||||
"title_align": "left",
|
"title_align": "left",
|
||||||
"box": box.HEAVY
|
"box": box.HEAVY,
|
||||||
}
|
}
|
||||||
|
|
||||||
for msg in msgs:
|
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:
|
def is_keyboard_int(msg: Message) -> bool:
|
||||||
return msg.text == MsgText.KeyboardInterruptMsg
|
return msg.text == MsgText.KeyboardInterruptMsg
|
||||||
|
|
||||||
|
|
||||||
def format_msg(msg: Message) -> Text:
|
def format_msg(msg: Message) -> Text:
|
||||||
text = (
|
text = (
|
||||||
textwrap.dedent(msg.text.value.format(**msg.params))
|
textwrap.dedent(msg.text.value.format(**msg.params)).strip()
|
||||||
.strip()
|
|
||||||
# .splitlines(keepends=True)
|
# .splitlines(keepends=True)
|
||||||
)
|
)
|
||||||
result = Text(text)
|
result = Text(text)
|
||||||
|
|
Loading…
Add table
Reference in a new issue