fix linting issues in current codebase

This commit is contained in:
Jonathan Wren 2022-10-30 14:30:18 -07:00
parent b894eab6ac
commit af8d7536d9
No known key found for this signature in database
4 changed files with 11 additions and 15 deletions

View file

@ -2,6 +2,7 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html
import base64
import contextlib
import hashlib
import logging
import os
@ -202,10 +203,9 @@ def set_keychain(journal_name, password):
import keyring
if password is None:
try:
cm = contextlib.suppress(keyring.errors.KeyringError)
with cm:
keyring.delete_password("jrnl", journal_name)
except keyring.errors.KeyringError:
pass
else:
try:
keyring.set_password("jrnl", journal_name, password)

View file

@ -1,10 +1,6 @@
# Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
from jrnl.messages.Message import Message
from jrnl.messages.MsgStyle import MsgStyle
from jrnl.messages.MsgText import MsgText
Message = Message
MsgStyle = MsgStyle
MsgText = MsgText
from jrnl.messages.Message import Message # noqa: F401
from jrnl.messages.MsgStyle import MsgStyle # noqa: F401
from jrnl.messages.MsgText import MsgText # noqa: F401

View file

@ -2,7 +2,7 @@
# License: https://www.gnu.org/licenses/gpl-3.0.html
import textwrap
from typing import Union
from typing import Optional
from rich.console import Console
from rich.text import Text
@ -69,7 +69,7 @@ def list_journals(configuration, format=None):
return journal_list_to_stdout(journal_list)
def print_msg(msg: Message, **kwargs) -> Union[None, str]:
def print_msg(msg: Message, **kwargs) -> Optional[str]:
"""Helper function to print a single message"""
kwargs["style"] = msg.style
return print_msgs([msg], **kwargs)
@ -81,7 +81,7 @@ def print_msgs(
style: MsgStyle = MsgStyle.NORMAL,
get_input: bool = False,
hide_input: bool = False,
) -> Union[None, str]:
) -> Optional[str]:
# Same as print_msg, but for a list
text = Text("", end="")
kwargs = style.decoration.args

View file

@ -78,11 +78,11 @@ class MarkdownExporter(TextExporter):
out = []
year, month = -1, -1
for e in journal.entries:
if not e.date.year == year:
if e.date.year != year:
year = e.date.year
out.append("# " + str(year))
out.append("")
if not e.date.month == month:
if e.date.month != month:
month = e.date.month
out.append("## " + e.date.strftime("%B"))
out.append("")