mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 04:58:32 +02:00
Sort Imports
This commit is contained in:
parent
a2fceb0a2d
commit
e5655cace4
26 changed files with 128 additions and 100 deletions
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2014 Manuel Ebert
|
Copyright (c) 2014-2018 Manuel Ebert
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from behave import *
|
|
||||||
import shutil
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
from behave import *
|
||||||
|
|
||||||
import jrnl
|
import jrnl
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from behave import given, when, then
|
|
||||||
from jrnl import cli, install, Journal, util, plugins
|
|
||||||
from jrnl import __version__
|
|
||||||
from dateutil import parser as date_parser
|
|
||||||
from collections import defaultdict
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import yaml
|
|
||||||
import keyring
|
|
||||||
import codecs
|
import codecs
|
||||||
|
from collections import defaultdict
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from behave import given, then, when
|
||||||
|
from dateutil import parser as date_parser
|
||||||
|
import keyring
|
||||||
|
import tzlocal
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from jrnl import Journal, __version__, cli, install, plugins, util
|
||||||
|
|
||||||
|
|
||||||
class TestKeyring(keyring.backend.KeyringBackend):
|
class TestKeyring(keyring.backend.KeyringBackend):
|
||||||
|
@ -36,9 +39,6 @@ try:
|
||||||
from io import StringIO
|
from io import StringIO
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import tzlocal
|
|
||||||
import shlex
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def ushlex(command):
|
def ushlex(command):
|
||||||
|
|
|
@ -2,20 +2,22 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from . import Entry
|
|
||||||
from . import Journal
|
|
||||||
from . import time as jrnl_time
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import time
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import os
|
||||||
import plistlib
|
import plistlib
|
||||||
import pytz
|
import re
|
||||||
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
import tzlocal
|
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
|
import pytz
|
||||||
|
import tzlocal
|
||||||
|
|
||||||
|
from . import Entry, Journal
|
||||||
|
from . import time as jrnl_time
|
||||||
|
|
||||||
|
|
||||||
class DayOne(Journal.Journal):
|
class DayOne(Journal.Journal):
|
||||||
"""A special Journal handling DayOne files"""
|
"""A special Journal handling DayOne files"""
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from . import Journal, util
|
import base64
|
||||||
|
import hashlib
|
||||||
|
|
||||||
from cryptography.fernet import Fernet, InvalidToken
|
from cryptography.fernet import Fernet, InvalidToken
|
||||||
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives import hashes, padding
|
from cryptography.hazmat.primitives import hashes, padding
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
import hashlib
|
|
||||||
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
|
||||||
from cryptography.hazmat.backends import default_backend
|
|
||||||
import base64
|
from . import Journal, util
|
||||||
|
|
||||||
|
|
||||||
def make_key(password):
|
def make_key(password):
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
import re
|
import re
|
||||||
import textwrap
|
import textwrap
|
||||||
from datetime import datetime
|
|
||||||
from .util import split_title
|
from .util import split_title
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from . import Entry
|
|
||||||
from . import util
|
|
||||||
from . import time
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import codecs
|
import codecs
|
||||||
import re
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from . import Entry, time, util
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from . import cli
|
|
||||||
|
|
||||||
|
from . import cli
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli.run()
|
cli.run()
|
||||||
|
|
20
jrnl/cli.py
20
jrnl/cli.py
|
@ -7,21 +7,17 @@
|
||||||
license: MIT, see LICENSE for more details.
|
license: MIT, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from __future__ import absolute_import
|
|
||||||
from . import Journal
|
|
||||||
from . import util
|
|
||||||
from . import install
|
|
||||||
from . import plugins
|
|
||||||
from .util import ERROR_COLOR, RESET_COLOR
|
|
||||||
import jrnl
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from . import DayOneJournal
|
import sys
|
||||||
from . import EncryptedJournal
|
|
||||||
from . import Journal
|
import jrnl
|
||||||
|
|
||||||
|
from . import DayOneJournal, EncryptedJournal, Journal, install, plugins, util
|
||||||
|
from .util import ERROR_COLOR, RESET_COLOR
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from .util import ERROR_COLOR, RESET_COLOR
|
|
||||||
from .util import slugify, u
|
|
||||||
from .template import Template
|
|
||||||
import os
|
|
||||||
import codecs
|
import codecs
|
||||||
|
import os
|
||||||
|
|
||||||
|
from .template import Template
|
||||||
|
from .util import ERROR_COLOR, RESET_COLOR, slugify, u
|
||||||
|
|
||||||
|
|
||||||
class Exporter(object):
|
class Exporter(object):
|
||||||
|
|
|
@ -2,18 +2,19 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
import readline
|
|
||||||
import glob
|
|
||||||
import getpass
|
import getpass
|
||||||
import os
|
import glob
|
||||||
import xdg.BaseDirectory
|
|
||||||
from . import util
|
|
||||||
from . import upgrade
|
|
||||||
from . import __version__
|
|
||||||
from .Journal import PlainJournal
|
|
||||||
from .EncryptedJournal import EncryptedJournal
|
|
||||||
import yaml
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import readline
|
||||||
|
|
||||||
|
import xdg.BaseDirectory
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from . import __version__, upgrade, util
|
||||||
|
from .EncryptedJournal import EncryptedJournal
|
||||||
|
from .Journal import PlainJournal
|
||||||
|
|
||||||
DEFAULT_CONFIG_NAME = 'jrnl.yaml'
|
DEFAULT_CONFIG_NAME = 'jrnl.yaml'
|
||||||
DEFAULT_JOURNAL_NAME = 'journal.txt'
|
DEFAULT_JOURNAL_NAME = 'journal.txt'
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
|
||||||
from .jrnl_importer import JRNLImporter
|
from .jrnl_importer import JRNLImporter
|
||||||
from .json_exporter import JSONExporter
|
from .json_exporter import JSONExporter
|
||||||
from .markdown_exporter import MarkdownExporter
|
from .markdown_exporter import MarkdownExporter
|
||||||
from .tag_exporter import TagExporter
|
from .tag_exporter import TagExporter
|
||||||
|
from .template_exporter import __all__ as template_exporters
|
||||||
|
from .text_exporter import TextExporter
|
||||||
from .xml_exporter import XMLExporter
|
from .xml_exporter import XMLExporter
|
||||||
from .yaml_exporter import YAMLExporter
|
from .yaml_exporter import YAMLExporter
|
||||||
from .template_exporter import __all__ as template_exporters
|
|
||||||
|
|
||||||
__exporters =[JSONExporter, MarkdownExporter, TagExporter, TextExporter, XMLExporter, YAMLExporter] + template_exporters
|
__exporters =[JSONExporter, MarkdownExporter, TagExporter, TextExporter, XMLExporter, YAMLExporter] + template_exporters
|
||||||
__importers =[JRNLImporter]
|
__importers =[JRNLImporter]
|
||||||
|
|
|
@ -2,10 +2,13 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .. import util
|
from .. import util
|
||||||
|
|
||||||
|
|
||||||
class JRNLImporter(object):
|
class JRNLImporter(object):
|
||||||
"""This plugin imports entries from other jrnl files."""
|
"""This plugin imports entries from other jrnl files."""
|
||||||
names = ["jrnl"]
|
names = ["jrnl"]
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from .text_exporter import TextExporter
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
from .text_exporter import TextExporter
|
||||||
from .util import get_tags_count
|
from .util import get_tags_count
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals, print_function
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
from .text_exporter import TextExporter
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from ..util import WARNING_COLOR, RESET_COLOR
|
|
||||||
|
from ..util import RESET_COLOR, WARNING_COLOR
|
||||||
|
from .text_exporter import TextExporter
|
||||||
|
|
||||||
|
|
||||||
class MarkdownExporter(TextExporter):
|
class MarkdownExporter(TextExporter):
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
from .text_exporter import TextExporter
|
||||||
from .util import get_tags_count
|
from .util import get_tags_count
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import asteval
|
import asteval
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
|
||||||
from .template import Template
|
|
||||||
import os
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
import os
|
||||||
|
|
||||||
|
from .template import Template
|
||||||
|
from .text_exporter import TextExporter
|
||||||
|
|
||||||
|
|
||||||
class GenericTemplateExporter(TextExporter):
|
class GenericTemplateExporter(TextExporter):
|
||||||
|
|
|
@ -2,10 +2,11 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
from ..util import u, slugify
|
|
||||||
import os
|
import os
|
||||||
from ..util import ERROR_COLOR, RESET_COLOR
|
|
||||||
|
from ..util import ERROR_COLOR, RESET_COLOR, slugify, u
|
||||||
|
|
||||||
|
|
||||||
class TextExporter(object):
|
class TextExporter(object):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
|
|
||||||
def get_tags_count(journal):
|
def get_tags_count(journal):
|
||||||
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
|
"""Returns a set of tuples (count, tag) for all tags present in the journal."""
|
||||||
# Astute reader: should the following line leave you as puzzled as me the first time
|
# Astute reader: should the following line leave you as puzzled as me the first time
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
|
from xml.dom import minidom
|
||||||
|
|
||||||
|
from ..util import u
|
||||||
from .json_exporter import JSONExporter
|
from .json_exporter import JSONExporter
|
||||||
from .util import get_tags_count
|
from .util import get_tags_count
|
||||||
from ..util import u
|
|
||||||
from xml.dom import minidom
|
|
||||||
|
|
||||||
|
|
||||||
class XMLExporter(JSONExporter):
|
class XMLExporter(JSONExporter):
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals, print_function
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
from .text_exporter import TextExporter
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from ..util import WARNING_COLOR, ERROR_COLOR, RESET_COLOR
|
|
||||||
|
from ..util import ERROR_COLOR, RESET_COLOR, WARNING_COLOR
|
||||||
|
from .text_exporter import TextExporter
|
||||||
|
|
||||||
|
|
||||||
class YAMLExporter(TextExporter):
|
class YAMLExporter(TextExporter):
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from dateutil.parser import parse as dateparse
|
from dateutil.parser import parse as dateparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import parsedatetime.parsedatetime_consts as pdt
|
import parsedatetime.parsedatetime_consts as pdt
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from . import __version__
|
|
||||||
from . import Journal
|
|
||||||
from . import util
|
|
||||||
from .EncryptedJournal import EncryptedJournal
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import codecs
|
import codecs
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from . import Journal, __version__, util
|
||||||
|
from .EncryptedJournal import EncryptedJournal
|
||||||
|
|
||||||
|
|
||||||
def backup(filename, binary=False):
|
def backup(filename, binary=False):
|
||||||
|
|
25
jrnl/util.py
25
jrnl/util.py
|
@ -1,24 +1,25 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import sys
|
import codecs
|
||||||
import os
|
|
||||||
import getpass as gp
|
import getpass as gp
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
|
from six import string_types
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
if "win32" in sys.platform:
|
if "win32" in sys.platform:
|
||||||
import colorama
|
import colorama
|
||||||
colorama.init()
|
colorama.init()
|
||||||
import re
|
|
||||||
import tempfile
|
|
||||||
import subprocess
|
|
||||||
import codecs
|
|
||||||
import unicodedata
|
|
||||||
import shlex
|
|
||||||
import logging
|
|
||||||
from six import string_types
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
8
setup.py
8
setup.py
|
@ -37,13 +37,15 @@ Links
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
try:
|
try:
|
||||||
import readline # NOQA
|
import readline # NOQA
|
||||||
readline_available = True
|
readline_available = True
|
||||||
|
|
Loading…
Add table
Reference in a new issue