diff --git a/.travis.yml b/.travis.yml index 3ea47338..1d53419a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,6 +53,13 @@ jobs: - os: windows include: + - stage: Lint & Tests + name: Lint, via Black + python: 3.8 + # black is automatically installed by peotry + script: + - black --check . --verbose --diff + # Python 3.6 Tests - name: Python 3.6 on Linux python: 3.6 diff --git a/features/steps/core.py b/features/steps/core.py index 77831086..a52334a7 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -60,12 +60,14 @@ def read_journal(journal_name="default"): def open_journal(journal_name="default"): config = util.load_config(install.CONFIG_FILE_PATH) journal_conf = config["journals"][journal_name] - if ( - type(journal_conf) is dict - ): # We can override the default config on a by-journal basis + + # We can override the default config on a by-journal basis + if type(journal_conf) is dict: config.update(journal_conf) - else: # But also just give them a string to point to the journal file + # But also just give them a string to point to the journal file + else: config["journal"] = journal_conf + return Journal.open_journal(journal_name, config) diff --git a/jrnl/Entry.py b/jrnl/Entry.py index 09e3fd57..80754e05 100755 --- a/jrnl/Entry.py +++ b/jrnl/Entry.py @@ -108,9 +108,7 @@ class Entry: return title else: return "{title}{sep}{body}\n".format( - title=title, - sep="\n" if has_body else "", - body=body if has_body else "", + title=title, sep="\n" if has_body else "", body=body if has_body else "" ) def __repr__(self): diff --git a/jrnl/install.py b/jrnl/install.py index be79724a..118b7c32 100644 --- a/jrnl/install.py +++ b/jrnl/install.py @@ -138,9 +138,8 @@ def install(): os.path.expandvars(journal_path) ) - path = os.path.split(default_config["journals"][DEFAULT_JOURNAL_KEY])[ - 0 - ] # If the folder doesn't exist, create it + # If the folder doesn't exist, create it + path = os.path.split(default_config["journals"][DEFAULT_JOURNAL_KEY])[0] try: os.makedirs(path) except OSError: diff --git a/jrnl/upgrade.py b/jrnl/upgrade.py index ac29240b..e252d2d0 100644 --- a/jrnl/upgrade.py +++ b/jrnl/upgrade.py @@ -26,7 +26,7 @@ def upgrade_jrnl_if_necessary(config_path): config = util.load_config(config_path) print( - """Welcome to jrnl {}. + f"""Welcome to jrnl {__version__}. It looks like you've been using an older version of jrnl until now. That's okay - jrnl will now upgrade your configuration and journal files. Afterwards @@ -40,10 +40,9 @@ you can enjoy all of the great new features that come with jrnl 2: Please note that jrnl 1.x is NOT forward compatible with this version of jrnl. If you choose to proceed, you will not be able to use your journals with older versions of jrnl anymore. -""".format( - __version__ - ) +""" ) + encrypted_journals = {} plain_journals = {} other_journals = {}