summaryrefslogtreecommitdiffstats
path: root/jrnl
diff options
context:
space:
mode:
authorJonathan Wren <jonathan@nowandwren.com>2022-11-03 07:18:35 -0700
committerGitHub <noreply@github.com>2022-11-03 07:18:35 -0700
commitc1eb0c54a35049b46e0f718cea6cda823852fb93 (patch)
tree9992a16dfee63f8fa0203cbe2ef68eb3c04770ef /jrnl
parentcb7e0ed2892db5e0e22adacb4c5bcfde743c437c (diff)
Add `type-checking` plugin to linting checks (#1629)
* add type-checking plugin for flakeheaven * update lock file * fix type-checking issues in current codebase * run linters
Diffstat (limited to 'jrnl')
-rw-r--r--jrnl/exception.py8
-rw-r--r--jrnl/messages/Message.py7
-rw-r--r--jrnl/override.py7
3 files changed, 15 insertions, 7 deletions
diff --git a/jrnl/exception.py b/jrnl/exception.py
index 86140cd9..b4ec2be8 100644
--- a/jrnl/exception.py
+++ b/jrnl/exception.py
@@ -1,14 +1,18 @@
# Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
-from jrnl.messages import Message
+from typing import TYPE_CHECKING
+
from jrnl.output import print_msg
+if TYPE_CHECKING:
+ from jrnl.messages import Message
+
class JrnlException(Exception):
"""Common exceptions raised by jrnl."""
- def __init__(self, *messages: Message):
+ def __init__(self, *messages: "Message"):
self.messages = messages
def print(self) -> None:
diff --git a/jrnl/messages/Message.py b/jrnl/messages/Message.py
index e4d6176a..bb193f5f 100644
--- a/jrnl/messages/Message.py
+++ b/jrnl/messages/Message.py
@@ -1,14 +1,17 @@
# Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
+from typing import TYPE_CHECKING
from typing import Mapping
from typing import NamedTuple
from jrnl.messages.MsgStyle import MsgStyle
-from jrnl.messages.MsgText import MsgText
+
+if TYPE_CHECKING:
+ from jrnl.messages.MsgText import MsgText
class Message(NamedTuple):
- text: MsgText
+ text: "MsgText"
style: MsgStyle = MsgStyle.NORMAL
params: Mapping = {}
diff --git a/jrnl/override.py b/jrnl/override.py
index 4b6506ee..75a400b9 100644
--- a/jrnl/override.py
+++ b/jrnl/override.py
@@ -1,14 +1,15 @@
# Copyright © 2012-2022 jrnl contributors
# License: https://www.gnu.org/licenses/gpl-3.0.html
-
-from argparse import Namespace
+from typing import TYPE_CHECKING
from jrnl.config import make_yaml_valid_dict
from jrnl.config import update_config
+if TYPE_CHECKING:
+ from argparse import Namespace
# import logging
-def apply_overrides(args: Namespace, base_config: dict) -> dict:
+def apply_overrides(args: "Namespace", base_config: dict) -> dict:
"""Unpack CLI provided overrides into the configuration tree.
:param overrides: List of configuration key-value pairs collected from the CLI