clean up import statements

This commit is contained in:
Jonathan Wren 2020-08-15 18:49:23 -07:00
parent 73a348b033
commit 9ccbcdcc7e
No known key found for this signature in database
GPG key ID: 43D5FF8722E7F68A
23 changed files with 66 additions and 50 deletions

View file

@ -3,7 +3,6 @@ import shutil
from jrnl.os_compat import on_windows
CWD = os.getcwd()

View file

@ -7,17 +7,18 @@ import shlex
import time
from unittest.mock import patch
from behave import given
from behave import then
from behave import when
import keyring
import toml
import yaml
from behave import given, then, when
from jrnl import Journal
from jrnl import __version__
from jrnl import cli
from jrnl import install
from jrnl import plugins
from jrnl.config import load_config
from jrnl.os_compat import on_windows
@ -398,9 +399,10 @@ def list_journal_directory(context, journal="default"):
@then("the Python version warning should appear if our version is below {version}")
def check_python_warning_if_version_low_enough(context, version):
import packaging.version
import platform
import packaging.version
if packaging.version.parse(platform.python_version()) < packaging.version.parse(
version
):

View file

@ -3,7 +3,8 @@ import os
import shutil
from xml.etree import ElementTree
from behave import given, then
from behave import given
from behave import then
@then("the output should be parsable as json")

View file

@ -4,18 +4,21 @@ from datetime import datetime
import fnmatch
import os
from pathlib import Path
import platform
import plistlib
import re
import socket
import time
import uuid
from xml.parsers.expat import ExpatError
import socket
import platform
import pytz
import tzlocal
from . import __title__, __version__, Entry, Journal
from . import Entry
from . import Journal
from . import __title__
from . import __version__
class DayOne(Journal.Journal):

View file

@ -1,19 +1,25 @@
import base64
import getpass
import hashlib
import logging
import os
import sys
from typing import Callable, Optional
import getpass
from typing import Callable
from typing import Optional
from cryptography.fernet import Fernet, InvalidToken
from cryptography.fernet import Fernet
from cryptography.fernet import InvalidToken
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import modes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
from .Journal import Journal
from .Journal import LegacyJournal
from .prompt import create_password
from .Journal import Journal, LegacyJournal
def make_key(password):

View file

@ -19,14 +19,13 @@
import logging
import sys
from . import jrnl
from . import install
from .parse_args import parse_args
from .config import scope_config
from .exception import UserAbort
from . import jrnl
from .Journal import open_journal
from .config import get_journal_name
from .config import scope_config
from .exception import UserAbort
from .parse_args import parse_args
def configure_logger(debug=False):

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python
import colorama
import re
from string import punctuation
from string import whitespace
import colorama
from .os_compat import on_windows
if on_windows:

View file

@ -40,8 +40,8 @@ def postconfig_list(config, **kwargs):
def postconfig_import(args, config, **kwargs):
from .plugins import get_importer
from .Journal import open_journal
from .plugins import get_importer
# Requires opening the journal
journal = open_journal(args.journal_name, config)

View file

@ -1,6 +1,7 @@
import logging
import colorama
import sys
import colorama
import yaml
from .color import ERROR_COLOR

View file

@ -1,8 +1,8 @@
import tempfile
import os
import sys
import shlex
import subprocess
import sys
import tempfile
import textwrap
from .color import ERROR_COLOR

View file

@ -4,8 +4,10 @@ import glob
import logging
import os
import sys
import xdg.BaseDirectory
import yaml
from . import __version__
from .config import load_config
from .config import verify_config

View file

@ -3,10 +3,9 @@ import sys
from . import install
from . import plugins
from .editor import get_text_from_editor
from .color import ERROR_COLOR
from .color import RESET_COLOR
from .editor import get_text_from_editor
from .os_compat import on_windows

View file

@ -4,7 +4,9 @@ import logging
def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs):
import sys
import textwrap
from .color import RESET_COLOR, WARNING_COLOR
from .color import RESET_COLOR
from .color import WARNING_COLOR
warning_msg = f"""
The command {old_cmd} is deprecated and will be removed from jrnl soon.

View file

@ -2,16 +2,11 @@ import argparse
import re
import textwrap
from .plugins import util
from .plugins import IMPORT_FORMATS
from .commands import deprecated_cmd
from .commands import output
from .plugins import EXPORT_FORMATS
from .commands import preconfig_version
from .commands import preconfig_diagnostic
from .commands import postconfig_list
from .commands import postconfig_import
from .commands import postconfig_encrypt
from .commands import postconfig_decrypt
from .output import deprecated_cmd
from .plugins import IMPORT_FORMATS
from .plugins import util
class WrappingFormatter(argparse.RawTextHelpFormatter):

View file

@ -5,7 +5,9 @@ import os
import re
import sys
from jrnl.color import RESET_COLOR, WARNING_COLOR
from jrnl.color import RESET_COLOR
from jrnl.color import WARNING_COLOR
from .text_exporter import TextExporter

View file

@ -5,7 +5,8 @@ import os
import re
import unicodedata
from jrnl.color import ERROR_COLOR, RESET_COLOR
from jrnl.color import ERROR_COLOR
from jrnl.color import RESET_COLOR
class TextExporter:

View file

@ -5,7 +5,10 @@ import os
import re
import sys
from jrnl.color import ERROR_COLOR, RESET_COLOR, WARNING_COLOR
from jrnl.color import ERROR_COLOR
from jrnl.color import RESET_COLOR
from jrnl.color import WARNING_COLOR
from .text_exporter import TextExporter

View file

@ -1,5 +1,5 @@
import sys
import getpass
import sys
def create_password(

View file

@ -1,6 +1,5 @@
from datetime import datetime
FAKE_YEAR = 9999
DEFAULT_FUTURE = datetime(FAKE_YEAR, 12, 31, 23, 59, 59)
DEFAULT_PAST = datetime(FAKE_YEAR, 1, 1, 0, 0)

View file

@ -1,15 +1,15 @@
import os
import sys
from . import __version__
from . import Journal
from . import __version__
from .EncryptedJournal import EncryptedJournal
from .config import is_config_json
from .config import load_config
from .config import scope_config
from .exception import UpgradeValidationException
from .exception import UserAbort
from .prompt import yesno
from .EncryptedJournal import EncryptedJournal
def backup(filename, binary=False):

View file

@ -43,12 +43,10 @@ pytest = "^5.4.3"
jrnl = 'jrnl.cli:run'
[tool.isort]
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
multi_line_output = 7
force_single_line = true
line_length = 88
known_first_party = ["jrnl", "behave"]
known_first_party = ["jrnl"]
force_sort_within_sections = true
[build-system]

View file

@ -1,7 +1,8 @@
from jrnl.parse_args import parse_args
import shlex
import pytest
import shlex
from jrnl.parse_args import parse_args
def cli_as_dict(str):

View file

@ -1,4 +1,5 @@
import datetime
from jrnl import time