fix various small issues in the codebase

This commit is contained in:
Jonathan Wren 2020-04-11 14:25:50 -07:00
parent abad3a3a79
commit e3a46e9846
10 changed files with 6 additions and 25 deletions

View file

@ -10,7 +10,6 @@ import sys
import os
import base64
import logging
from typing import Optional
log = logging.getLogger()

View file

@ -2,7 +2,6 @@
# encoding: utf-8
from __future__ import absolute_import, unicode_literals
from . import Entry
from . import Journal
import codecs
import os

View file

@ -1,7 +1,5 @@
#!/usr/bin/env python
import os
try:
from .__version__ import __version__
except ImportError:

View file

@ -365,7 +365,7 @@ def run(manual_args=None):
try:
journal = open_journal(journal_name, config)
except KeyboardInterrupt:
print(f"[Interrupted while opening journal]", file=sys.stderr)
print("[Interrupted while opening journal]", file=sys.stderr)
sys.exit(1)
# Import mode

View file

@ -1,14 +1,11 @@
#!/usr/bin/env python
import glob
import getpass
import os
import xdg.BaseDirectory
from . import util
from . import upgrade
from . import __version__
from .Journal import PlainJournal
from .EncryptedJournal import EncryptedJournal
from .util import UserAbort, verify_config
import yaml
import logging

View file

@ -2,7 +2,6 @@
# encoding: utf-8
import sys
from .. import util
class JRNLImporter:
@ -15,7 +14,6 @@ class JRNLImporter:
"""Imports from an existing file if input is specified, and
standard input otherwise."""
old_cnt = len(journal.entries)
old_entries = journal.entries
if input:
with open(input, "r", encoding="utf-8") as f:
other_journal_txt = f.read()

View file

@ -2,7 +2,6 @@
# encoding: utf-8
from .text_exporter import TextExporter
import os
import re
import sys
from ..util import WARNING_COLOR, RESET_COLOR

View file

@ -6,9 +6,7 @@ EXPRESSION_RE = r"[\[\]():.a-zA-Z0-9_]*"
PRINT_RE = r"{{ *(.+?) *}}"
START_BLOCK_RE = r"{% *(if|for) +(.+?) *%}"
END_BLOCK_RE = r"{% *end(for|if) *%}"
FOR_RE = r"{{% *for +({varname}) +in +([^%]+) *%}}".format(
varname=VAR_RE, expression=EXPRESSION_RE
)
FOR_RE = r"{{% *for +({varname}) +in +([^%]+) *%}}".format(varname=VAR_RE)
IF_RE = r"{% *if +(.+?) *%}"
BLOCK_RE = r"{% *block +(.+?) *%}((?:.|\n)+?){% *endblock *%}"
INCLUDE_RE = r"{% *include +(.+?) *%}"

View file

@ -2,7 +2,6 @@
# encoding: utf-8
from .text_exporter import TextExporter
import os
import re
import sys
from ..util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR
@ -19,10 +18,9 @@ class YAMLExporter(TextExporter):
"""Returns a markdown representation of a single entry, with YAML front matter."""
if to_multifile is False:
print(
"{}ERROR{}: YAML export must be to individual files. Please \
specify a directory to export to.".format(
ERROR_COLOR, RESET_COLOR, file=sys.stderr
)
f"{ERROR_COLOR}ERROR{RESET_COLOR}: YAML export must be to individual files. Please \
specify a directory to export to.",
file=sys.stderr,
)
return