mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
parent
1cc3f80ba9
commit
cfadcd39ca
24 changed files with 107 additions and 89 deletions
|
@ -1,5 +1,5 @@
|
||||||
import shutil
|
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
|
import ast
|
||||||
|
from collections import defaultdict
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shlex
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from behave import given, when, then
|
import keyring
|
||||||
from jrnl import cli, install, Journal, util, plugins
|
import toml
|
||||||
from jrnl import __version__
|
import yaml
|
||||||
from collections import defaultdict
|
|
||||||
|
from behave import given, then, when
|
||||||
|
from jrnl import Journal, __version__, cli, install, plugins, util
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import parsedatetime.parsedatetime_consts as pdt
|
import parsedatetime.parsedatetime_consts as pdt
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import parsedatetime as pdt
|
import parsedatetime as pdt
|
||||||
import time
|
|
||||||
import os
|
|
||||||
import ast
|
|
||||||
import yaml
|
|
||||||
import keyring
|
|
||||||
import shlex
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
import toml
|
|
||||||
|
|
||||||
consts = pdt.Constants(usePyICU=False)
|
consts = pdt.Constants(usePyICU=False)
|
||||||
consts.DOWParseStyle = -1 # Prefers past weekdays
|
consts.DOWParseStyle = -1 # Prefers past weekdays
|
||||||
|
|
|
@ -3,7 +3,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
from behave import then, given
|
from behave import given, then
|
||||||
|
|
||||||
|
|
||||||
@then("the output should be parsable as json")
|
@then("the output should be parsable as json")
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from . import Entry
|
|
||||||
from . import Journal
|
|
||||||
from . import time as jrnl_time
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import time
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
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,16 +1,17 @@
|
||||||
from . import util
|
import base64
|
||||||
from .Journal import Journal, LegacyJournal
|
import hashlib
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
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 sys
|
|
||||||
import os
|
|
||||||
import base64
|
|
||||||
import logging
|
|
||||||
|
|
||||||
|
from . import util
|
||||||
|
from .Journal import Journal, LegacyJournal
|
||||||
|
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import re
|
|
||||||
import ansiwrap
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from .util import split_title, colorize, highlight_tags_with_background_color
|
import re
|
||||||
|
|
||||||
|
import ansiwrap
|
||||||
|
|
||||||
|
from .util import colorize, highlight_tags_with_background_color, split_title
|
||||||
|
|
||||||
|
|
||||||
class Entry:
|
class Entry:
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
|
||||||
from . import Journal
|
|
||||||
import codecs
|
import codecs
|
||||||
import os
|
|
||||||
import fnmatch
|
import fnmatch
|
||||||
|
import os
|
||||||
|
|
||||||
|
from . import Journal
|
||||||
|
|
||||||
|
|
||||||
def get_files(journal_config):
|
def get_files(journal_config):
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from datetime import datetime
|
from jrnl import Entry, time, util
|
||||||
from jrnl import Entry, util, time
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
from . import cli
|
from . import cli
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
cli.run()
|
cli.run()
|
||||||
|
|
18
jrnl/cli.py
18
jrnl/cli.py
|
@ -19,17 +19,17 @@
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from .Journal import PlainJournal, open_journal
|
|
||||||
from .EncryptedJournal import EncryptedJournal
|
|
||||||
from . import util
|
|
||||||
from . import install
|
|
||||||
from . import plugins
|
|
||||||
from .util import ERROR_COLOR, RESET_COLOR, UserAbort
|
|
||||||
import jrnl
|
|
||||||
import argparse
|
import argparse
|
||||||
import sys
|
|
||||||
import re
|
|
||||||
import logging
|
import logging
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import jrnl
|
||||||
|
|
||||||
|
from . import install, plugins, util
|
||||||
|
from .EncryptedJournal import EncryptedJournal
|
||||||
|
from .Journal import PlainJournal, open_journal
|
||||||
|
from .util import ERROR_COLOR, RESET_COLOR, UserAbort
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
logging.getLogger("keyring.backend").setLevel(logging.ERROR)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import glob
|
import glob
|
||||||
import os
|
|
||||||
import xdg.BaseDirectory
|
|
||||||
from . import util
|
|
||||||
from . import upgrade
|
|
||||||
from . import __version__
|
|
||||||
from .util import UserAbort, verify_config
|
|
||||||
import yaml
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import xdg.BaseDirectory
|
||||||
|
import yaml
|
||||||
|
|
||||||
|
from . import __version__, upgrade, util
|
||||||
|
from .util import UserAbort, verify_config
|
||||||
|
|
||||||
if "win32" not in sys.platform:
|
if "win32" not in sys.platform:
|
||||||
# readline is not included in Windows Active Python
|
# readline is not included in Windows Active Python
|
||||||
import readline
|
import readline
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
from .fancy_exporter import FancyExporter
|
||||||
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
|
|
||||||
from .fancy_exporter import FancyExporter
|
|
||||||
|
|
||||||
__exporters = [
|
__exporters = [
|
||||||
JSONExporter,
|
JSONExporter,
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals, print_function
|
|
||||||
from .text_exporter import TextExporter
|
|
||||||
from textwrap import TextWrapper
|
from textwrap import TextWrapper
|
||||||
|
|
||||||
|
from .text_exporter import TextExporter
|
||||||
|
|
||||||
|
|
||||||
class FancyExporter(TextExporter):
|
class FancyExporter(TextExporter):
|
||||||
"""This Exporter can convert entries and journals into text with unicode box drawing characters."""
|
"""This Exporter can convert entries and journals into text with unicode box drawing characters."""
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
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,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
|
||||||
import re
|
|
||||||
import os
|
import os
|
||||||
|
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):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*"
|
VAR_RE = r"[_a-zA-Z][a-zA-Z0-9_]*"
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
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):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from ..util import slugify
|
|
||||||
import os
|
import os
|
||||||
from ..util import ERROR_COLOR, RESET_COLOR
|
|
||||||
|
from ..util import ERROR_COLOR, RESET_COLOR, slugify
|
||||||
|
|
||||||
|
|
||||||
class TextExporter:
|
class TextExporter:
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
|
from xml.dom import minidom
|
||||||
|
|
||||||
from .json_exporter import JSONExporter
|
from .json_exporter import JSONExporter
|
||||||
from .util import get_tags_count
|
from .util import get_tags_count
|
||||||
from xml.dom import minidom
|
|
||||||
|
|
||||||
|
|
||||||
class XMLExporter(JSONExporter):
|
class XMLExporter(JSONExporter):
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
|
||||||
import os
|
import os
|
||||||
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,4 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from dateutil.parser import parse as dateparse
|
from dateutil.parser import parse as dateparse
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from . import __version__
|
from . import Journal, __version__, util
|
||||||
from . import Journal
|
|
||||||
from . import util
|
|
||||||
from .EncryptedJournal import EncryptedJournal
|
from .EncryptedJournal import EncryptedJournal
|
||||||
from .util import UserAbort
|
from .util import UserAbort
|
||||||
import os
|
|
||||||
|
|
||||||
|
|
||||||
def backup(filename, binary=False):
|
def backup(filename, binary=False):
|
||||||
|
|
23
jrnl/util.py
23
jrnl/util.py
|
@ -1,21 +1,22 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import getpass as gp
|
import getpass as gp
|
||||||
import yaml
|
import logging
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shlex
|
||||||
|
from string import punctuation, whitespace
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from typing import Callable, Optional
|
||||||
|
import unicodedata
|
||||||
|
|
||||||
import colorama
|
import colorama
|
||||||
|
import yaml
|
||||||
|
|
||||||
if "win32" in sys.platform:
|
if "win32" in sys.platform:
|
||||||
colorama.init()
|
colorama.init()
|
||||||
import re
|
|
||||||
import tempfile
|
|
||||||
import subprocess
|
|
||||||
import unicodedata
|
|
||||||
import shlex
|
|
||||||
from string import punctuation, whitespace
|
|
||||||
import logging
|
|
||||||
from typing import Optional, Callable
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,15 @@ pyflakes = "^2.2.0"
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
jrnl = 'jrnl.cli:run'
|
jrnl = 'jrnl.cli:run'
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
multi_line_output = 3
|
||||||
|
include_trailing_comma = true
|
||||||
|
force_grid_wrap = 0
|
||||||
|
use_parentheses = true
|
||||||
|
line_length = 88
|
||||||
|
known_first_party = ["jrnl", "behave"]
|
||||||
|
force_sort_within_sections = true
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry>=0.12"]
|
requires = ["poetry>=0.12"]
|
||||||
build-backend = "poetry.masonry.api"
|
build-backend = "poetry.masonry.api"
|
||||||
|
|
Loading…
Add table
Reference in a new issue