mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-03 07:16:12 +02:00
remove py2 remnants and use mocks in tests
fstring wip Run pyupgrade fix broken pyupgrade fstring run pyupgrade on plugin dir fixup! remove py2 remnants and use mocks in tests small print bugfix The file=sys.stderr was part of the format(), so an error got printed to stdout Drop use of codecs package Use builtins.open() instead fixup! remove py2 remnants and use mocks in tests
This commit is contained in:
parent
b7e2e91af3
commit
9d8d6a83ae
28 changed files with 211 additions and 321 deletions
|
@ -1,7 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
import readline
|
||||
import glob
|
||||
import getpass
|
||||
|
@ -69,7 +67,7 @@ def upgrade_config(config):
|
|||
for key in missing_keys:
|
||||
config[key] = default_config[key]
|
||||
save_config(config)
|
||||
print("[Configuration updated to newest version at {}]".format(CONFIG_FILE_PATH))
|
||||
print(f"[Configuration updated to newest version at {CONFIG_FILE_PATH}]", file=sys.stderr)
|
||||
|
||||
|
||||
def save_config(config):
|
||||
|
@ -91,10 +89,10 @@ def load_or_install_jrnl():
|
|||
try:
|
||||
upgrade.upgrade_jrnl_if_necessary(config_path)
|
||||
except upgrade.UpgradeValidationException:
|
||||
util.prompt("Aborting upgrade.")
|
||||
util.prompt("Please tell us about this problem at the following URL:")
|
||||
util.prompt("https://github.com/jrnl-org/jrnl/issues/new?title=UpgradeValidationException")
|
||||
util.prompt("Exiting.")
|
||||
print("Aborting upgrade.", file=sys.stderr)
|
||||
print("Please tell us about this problem at the following URL:", file=sys.stderr)
|
||||
print("https://github.com/jrnl-org/jrnl/issues/new?title=UpgradeValidationException", file=sys.stderr)
|
||||
print("Exiting.", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
upgrade_config(config)
|
||||
|
@ -120,8 +118,8 @@ def install():
|
|||
readline.set_completer(autocomplete)
|
||||
|
||||
# Where to create the journal?
|
||||
path_query = 'Path to your journal file (leave blank for {}): '.format(JOURNAL_FILE_PATH)
|
||||
journal_path = util.py23_input(path_query).strip() or JOURNAL_FILE_PATH
|
||||
path_query = f'Path to your journal file (leave blank for {JOURNAL_FILE_PATH}): '
|
||||
journal_path = input(path_query).strip() or JOURNAL_FILE_PATH
|
||||
default_config['journals']['default'] = os.path.expanduser(os.path.expandvars(journal_path))
|
||||
|
||||
path = os.path.split(default_config['journals']['default'])[0] # If the folder doesn't exist, create it
|
||||
|
@ -139,7 +137,7 @@ def install():
|
|||
else:
|
||||
util.set_keychain("default", None)
|
||||
EncryptedJournal._create(default_config['journals']['default'], password)
|
||||
print("Journal will be encrypted.")
|
||||
print("Journal will be encrypted.", file=sys.stderr)
|
||||
else:
|
||||
PlainJournal._create(default_config['journals']['default'])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue