mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
udpate more import statements
This commit is contained in:
parent
f8d0467db8
commit
7c5af92eea
19 changed files with 49 additions and 53 deletions
|
@ -448,11 +448,11 @@ def open_journal(journal_name, config, legacy=False):
|
||||||
if config["journal"].strip("/").endswith(".dayone") or "entries" in os.listdir(
|
if config["journal"].strip("/").endswith(".dayone") or "entries" in os.listdir(
|
||||||
config["journal"]
|
config["journal"]
|
||||||
):
|
):
|
||||||
from . import DayOneJournal
|
from jrnl import DayOneJournal
|
||||||
|
|
||||||
return DayOneJournal.DayOne(**config).open()
|
return DayOneJournal.DayOne(**config).open()
|
||||||
else:
|
else:
|
||||||
from . import FolderJournal
|
from jrnl import FolderJournal
|
||||||
|
|
||||||
return FolderJournal.Folder(journal_name, **config).open()
|
return FolderJournal.Folder(journal_name, **config).open()
|
||||||
|
|
||||||
|
@ -460,12 +460,12 @@ def open_journal(journal_name, config, legacy=False):
|
||||||
if legacy:
|
if legacy:
|
||||||
return LegacyJournal(journal_name, **config).open()
|
return LegacyJournal(journal_name, **config).open()
|
||||||
if config["journal"].endswith(os.sep):
|
if config["journal"].endswith(os.sep):
|
||||||
from . import FolderJournal
|
from jrnl import FolderJournal
|
||||||
|
|
||||||
return FolderJournal.Folder(journal_name, **config).open()
|
return FolderJournal.Folder(journal_name, **config).open()
|
||||||
return PlainJournal(journal_name, **config).open()
|
return PlainJournal(journal_name, **config).open()
|
||||||
|
|
||||||
from . import EncryptedJournal
|
from jrnl import EncryptedJournal
|
||||||
|
|
||||||
if legacy:
|
if legacy:
|
||||||
return EncryptedJournal.LegacyEncryptedJournal(journal_name, **config).open()
|
return EncryptedJournal.LegacyEncryptedJournal(journal_name, **config).open()
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .__version__ import __version__
|
from jrnl.__version__ import __version__
|
||||||
except ImportError:
|
except ImportError:
|
||||||
__version__ = "source"
|
__version__ = "source"
|
||||||
__title__ = "jrnl"
|
__title__ = "jrnl"
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from .cli import cli
|
from jrnl.cli import cli
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(cli())
|
sys.exit(cli())
|
||||||
|
|
|
@ -50,14 +50,14 @@ conditions; for details, see: https://www.gnu.org/licenses/gpl-3.0.html"""
|
||||||
|
|
||||||
|
|
||||||
def postconfig_list(config, **kwargs):
|
def postconfig_list(config, **kwargs):
|
||||||
from .output import list_journals
|
from jrnl.output import list_journals
|
||||||
|
|
||||||
print(list_journals(config))
|
print(list_journals(config))
|
||||||
|
|
||||||
|
|
||||||
def postconfig_import(args, config, **kwargs):
|
def postconfig_import(args, config, **kwargs):
|
||||||
from .Journal import open_journal
|
from jrnl.Journal import open_journal
|
||||||
from .plugins import get_importer
|
from jrnl.plugins import get_importer
|
||||||
|
|
||||||
# Requires opening the journal
|
# Requires opening the journal
|
||||||
journal = open_journal(args.journal_name, config)
|
journal = open_journal(args.journal_name, config)
|
||||||
|
@ -70,10 +70,10 @@ def postconfig_encrypt(args, config, original_config, **kwargs):
|
||||||
"""
|
"""
|
||||||
Encrypt a journal in place, or optionally to a new file
|
Encrypt a journal in place, or optionally to a new file
|
||||||
"""
|
"""
|
||||||
from .config import update_config
|
from jrnl.config import update_config
|
||||||
from .EncryptedJournal import EncryptedJournal
|
from jrnl.EncryptedJournal import EncryptedJournal
|
||||||
from .install import save_config
|
from jrnl.install import save_config
|
||||||
from .Journal import open_journal
|
from jrnl.Journal import jrnlopen_journal
|
||||||
|
|
||||||
# Open the journal
|
# Open the journal
|
||||||
journal = open_journal(args.journal_name, config)
|
journal = open_journal(args.journal_name, config)
|
||||||
|
@ -118,10 +118,10 @@ def postconfig_encrypt(args, config, original_config, **kwargs):
|
||||||
|
|
||||||
def postconfig_decrypt(args, config, original_config, **kwargs):
|
def postconfig_decrypt(args, config, original_config, **kwargs):
|
||||||
"""Decrypts into new file. If filename is not set, we encrypt the journal file itself."""
|
"""Decrypts into new file. If filename is not set, we encrypt the journal file itself."""
|
||||||
from .config import update_config
|
from jrnl.config import update_config
|
||||||
from .install import save_config
|
from jrnl.install import save_config
|
||||||
from .Journal import PlainJournal
|
from jrnl.Journal import PlainJournal
|
||||||
from .Journal import open_journal
|
from jrnl.Journal import open_journal
|
||||||
|
|
||||||
journal = open_journal(args.journal_name, config)
|
journal = open_journal(args.journal_name, config)
|
||||||
journal.config["encrypt"] = False
|
journal.config["encrypt"] = False
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
from typing import Mapping
|
from typing import Mapping
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
|
||||||
from .MsgStyle import MsgStyle
|
from jrnl.messages.MsgStyle import MsgStyle
|
||||||
from .MsgText import MsgText
|
from jrnl.messages.MsgText import MsgText
|
||||||
|
|
||||||
|
|
||||||
class Message(NamedTuple):
|
class Message(NamedTuple):
|
||||||
|
|
|
@ -8,7 +8,7 @@ from typing import NamedTuple
|
||||||
from rich import box
|
from rich import box
|
||||||
from rich.panel import Panel
|
from rich.panel import Panel
|
||||||
|
|
||||||
from .MsgText import MsgText
|
from jrnl.messages.MsgText import MsgText
|
||||||
|
|
||||||
|
|
||||||
class MsgStyle(Enum):
|
class MsgStyle(Enum):
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Copyright (C) 2012-2022 jrnl contributors
|
# Copyright (C) 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
from .Message import Message
|
from jrnl.messages.Message import Message
|
||||||
from .MsgStyle import MsgStyle
|
from jrnl.messages.MsgStyle import MsgStyle
|
||||||
from .MsgText import MsgText
|
from jrnl.messages.MsgText import MsgText
|
||||||
|
|
||||||
Message = Message
|
Message = Message
|
||||||
MsgStyle = MsgStyle
|
MsgStyle = MsgStyle
|
||||||
|
|
|
@ -26,7 +26,7 @@ def deprecated_cmd(old_cmd, new_cmd, callback=None, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
def list_journals(configuration):
|
def list_journals(configuration):
|
||||||
from . import config
|
from jrnl import config
|
||||||
|
|
||||||
"""List the journals specified in the configuration file"""
|
"""List the journals specified in the configuration file"""
|
||||||
result = f"Journals defined in config ({config.get_config_path()})\n"
|
result = f"Journals defined in config ({config.get_config_path()})\n"
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Copyright (C) 2012-2022 jrnl contributors
|
# Copyright (C) 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
from .dates_exporter import DatesExporter
|
from jrnl.plugins.dates_exporter import DatesExporter
|
||||||
from .fancy_exporter import FancyExporter
|
from jrnl.plugins.fancy_exporter import FancyExporter
|
||||||
from .jrnl_importer import JRNLImporter
|
from jrnl.plugins.jrnl_importer import JRNLImporter
|
||||||
from .json_exporter import JSONExporter
|
from jrnl.plugins.json_exporter import JSONExporter
|
||||||
from .markdown_exporter import MarkdownExporter
|
from jrnl.plugins.markdown_exporter import MarkdownExporter
|
||||||
from .tag_exporter import TagExporter
|
from jrnl.plugins.tag_exporter import TagExporter
|
||||||
from .text_exporter import TextExporter
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .xml_exporter import XMLExporter
|
from jrnl.plugins.xml_exporter import XMLExporter
|
||||||
from .yaml_exporter import YAMLExporter
|
from jrnl.plugins.yaml_exporter import YAMLExporter
|
||||||
|
|
||||||
__exporters = [
|
__exporters = [
|
||||||
JSONExporter,
|
JSONExporter,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
|
|
||||||
|
|
||||||
class DatesExporter(TextExporter):
|
class DatesExporter(TextExporter):
|
||||||
|
|
|
@ -7,8 +7,7 @@ from jrnl.exception import JrnlException
|
||||||
from jrnl.messages import Message
|
from jrnl.messages import Message
|
||||||
from jrnl.messages import MsgStyle
|
from jrnl.messages import MsgStyle
|
||||||
from jrnl.messages import MsgText
|
from jrnl.messages import MsgText
|
||||||
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .text_exporter import TextExporter
|
|
||||||
|
|
||||||
|
|
||||||
class FancyExporter(TextExporter):
|
class FancyExporter(TextExporter):
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .util import get_tags_count
|
from jrnl.plugins.util import get_tags_count
|
||||||
|
|
||||||
|
|
||||||
class JSONExporter(TextExporter):
|
class JSONExporter(TextExporter):
|
||||||
|
|
|
@ -8,8 +8,7 @@ from jrnl.messages import Message
|
||||||
from jrnl.messages import MsgStyle
|
from jrnl.messages import MsgStyle
|
||||||
from jrnl.messages import MsgText
|
from jrnl.messages import MsgText
|
||||||
from jrnl.output import print_msg
|
from jrnl.output import print_msg
|
||||||
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .text_exporter import TextExporter
|
|
||||||
|
|
||||||
|
|
||||||
class MarkdownExporter(TextExporter):
|
class MarkdownExporter(TextExporter):
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Copyright (C) 2012-2022 jrnl contributors
|
# Copyright (C) 2012-2022 jrnl contributors
|
||||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
from .text_exporter import TextExporter
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .util import get_tags_count
|
from jrnl.plugins.util import get_tags_count
|
||||||
|
|
||||||
|
|
||||||
class TagExporter(TextExporter):
|
class TagExporter(TextExporter):
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
|
|
||||||
from .json_exporter import JSONExporter
|
from jrnl.plugins.json_exporter import JSONExporter
|
||||||
from .util import get_tags_count
|
from jrnl.plugins.util import get_tags_count
|
||||||
|
|
||||||
|
|
||||||
class XMLExporter(JSONExporter):
|
class XMLExporter(JSONExporter):
|
||||||
|
|
|
@ -9,8 +9,7 @@ from jrnl.messages import Message
|
||||||
from jrnl.messages import MsgStyle
|
from jrnl.messages import MsgStyle
|
||||||
from jrnl.messages import MsgText
|
from jrnl.messages import MsgText
|
||||||
from jrnl.output import print_msg
|
from jrnl.output import print_msg
|
||||||
|
from jrnl.plugins.text_exporter import TextExporter
|
||||||
from .text_exporter import TextExporter
|
|
||||||
|
|
||||||
|
|
||||||
class YAMLExporter(TextExporter):
|
class YAMLExporter(TextExporter):
|
||||||
|
|
|
@ -35,7 +35,7 @@ def create_password(journal_name: str) -> str:
|
||||||
print_msg(Message(MsgText.PasswordDidNotMatch, MsgStyle.ERROR))
|
print_msg(Message(MsgText.PasswordDidNotMatch, MsgStyle.ERROR))
|
||||||
|
|
||||||
if yesno(Message(MsgText.PasswordStoreInKeychain), default=True):
|
if yesno(Message(MsgText.PasswordStoreInKeychain), default=True):
|
||||||
from .EncryptedJournal import set_keychain
|
from jrnl.EncryptedJournal import set_keychain
|
||||||
|
|
||||||
set_keychain(journal_name, pw)
|
set_keychain(journal_name, pw)
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ test = [
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
force_single_line = true
|
force_single_line = true
|
||||||
known_first_party = ["jrnl"]
|
known_first_party = ["jrnl", "tests"]
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
minversion = "6.0"
|
minversion = "6.0"
|
||||||
|
|
|
@ -11,11 +11,10 @@ from pytest_bdd.parsers import parse
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
from jrnl.config import scope_config
|
from jrnl.config import scope_config
|
||||||
|
from tests.lib.helpers import assert_equal_tags_ignoring_order
|
||||||
from .helpers import assert_equal_tags_ignoring_order
|
from tests.lib.helpers import does_directory_contain_files
|
||||||
from .helpers import does_directory_contain_files
|
from tests.lib.helpers import get_nested_val
|
||||||
from .helpers import get_nested_val
|
from tests.lib.helpers import parse_should_or_should_not
|
||||||
from .helpers import parse_should_or_should_not
|
|
||||||
|
|
||||||
|
|
||||||
@then("we should get no error")
|
@then("we should get no error")
|
||||||
|
|
Loading…
Add table
Reference in a new issue