reformat with black

This commit is contained in:
Jonathan Wren 2022-03-12 14:53:04 -08:00
parent 548ac582d9
commit 4a4a874f9f
6 changed files with 28 additions and 9 deletions

View file

@ -27,7 +27,6 @@ from jrnl.messages import MsgText
from jrnl.messages import MsgType
def make_key(password):
password = password.encode("utf-8")
kdf = PBKDF2HMAC(

View file

@ -198,7 +198,11 @@ def get_journal_name(args, config):
if args.journal_name not in config["journals"]:
raise JrnlException(
Message(MsgText.NoDefaultJournal, MsgType.ERROR, { "journals": list_journals(config)}),
Message(
MsgText.NoDefaultJournal,
MsgType.ERROR,
{"journals": list_journals(config)},
),
)
logging.debug("Using journal name: %s", args.journal_name)

View file

@ -31,7 +31,11 @@ def get_text_from_editor(config, template=""):
subprocess.call(split_args(config["editor"]) + [tmpfile])
except FileNotFoundError:
raise JrnlException(
Message(MsgText.EditorMisconfigured, MsgType.ERROR, { "editor_key": config["editor"] })
Message(
MsgText.EditorMisconfigured,
MsgType.ERROR,
{"editor_key": config["editor"]},
)
)
with open(tmpfile, "r", encoding="utf-8") as f:

View file

@ -23,7 +23,6 @@ from jrnl.messages import MsgText
from jrnl.messages import MsgType
def upgrade_config(config_data, alt_config_path=None):
"""Checks if there are keys missing in a given config dict, and if so, updates the config file accordingly.
This essentially automatically ports jrnl installations if new config parameters are introduced in later
@ -54,7 +53,9 @@ def find_default_config():
def find_alt_config(alt_config):
if not os.path.exists(alt_config):
raise JrnlException(
Message(MsgText.AltConfigNotFound, MsgType.ERROR, { "config_file": alt_config })
Message(
MsgText.AltConfigNotFound, MsgType.ERROR, {"config_file": alt_config}
)
)
return alt_config

View file

@ -136,7 +136,9 @@ def write_mode(args, config, journal, **kwargs):
if not raw:
logging.error("Write mode: couldn't get raw text")
raise JrnlException(Message(MsgText.JrnlExceptionMessage.NoTextReceived, MsgType.ERROR))
raise JrnlException(
Message(MsgText.JrnlExceptionMessage.NoTextReceived, MsgType.ERROR)
)
logging.debug(
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
@ -200,7 +202,13 @@ def _get_editor_template(config, **kwargs):
logging.debug("Write mode: template loaded: %s", template)
except OSError:
logging.error("Write mode: template not loaded")
raise JrnlException(Message(MsgText.CantReadTemplate, MsgType.ERROR, { "template": config["template"] }))
raise JrnlException(
Message(
MsgText.CantReadTemplate,
MsgType.ERROR,
{"template": config["template"]},
)
)
return template
@ -238,7 +246,11 @@ def _edit_search_results(config, journal, old_entries, **kwargs):
"""
if not config["editor"]:
raise JrnlException(
Message(MsgText.EditorNotConfigured, MsgType.ERROR, {"config_file": get_config_path()})
Message(
MsgText.EditorNotConfigured,
MsgType.ERROR,
{"config_file": get_config_path()},
)
)
# separate entries we are not editing

View file

@ -20,7 +20,6 @@ from jrnl.messages import MsgText
from jrnl.messages import MsgType
def backup(filename, binary=False):
print(f" Created a backup at {filename}.backup", file=sys.stderr)
filename = os.path.expanduser(os.path.expandvars(filename))