diff --git a/jrnl/encryption/BaseEncryption.py b/jrnl/encryption/BaseEncryption.py index db2fb4a6..882c6cad 100644 --- a/jrnl/encryption/BaseEncryption.py +++ b/jrnl/encryption/BaseEncryption.py @@ -12,8 +12,9 @@ from jrnl.messages import MsgText class BaseEncryption(ABC): _encoding: str _journal_name: str + _config: dict - def __init__(self, journal_name, config): + def __init__(self, journal_name: str, config: dict): self._encoding = "utf-8" self._journal_name = journal_name self._config = config diff --git a/jrnl/encryption/BasePasswordEncryption.py b/jrnl/encryption/BasePasswordEncryption.py index 163b6cf0..34a04542 100644 --- a/jrnl/encryption/BasePasswordEncryption.py +++ b/jrnl/encryption/BasePasswordEncryption.py @@ -11,7 +11,7 @@ class BasePasswordEncryption(BaseEncryption): _max_attempts: int _password: str - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) self._attempts = 0 self._max_attempts = 3 @@ -23,11 +23,11 @@ class BasePasswordEncryption(BaseEncryption): self.password = keyring_pw @property - def password(self): + def password(self) -> str: return self._password @password.setter - def password(self, value): + def password(self, value: str) -> None: self._password = value def encrypt(self, text: str) -> str: @@ -43,7 +43,7 @@ class BasePasswordEncryption(BaseEncryption): return result - def _prompt_password(self): + def _prompt_password(self) -> None: self._attempts, self.password = prompt_password( self._attempts, self._max_attempts ) diff --git a/jrnl/output.py b/jrnl/output.py index b82ec122..4b18a344 100644 --- a/jrnl/output.py +++ b/jrnl/output.py @@ -38,7 +38,7 @@ def list_journals(configuration): return result -def print_msg(msg: Message, **kwargs) -> Union[None, str]: +def print_msg(msg: Message, **kwargs) -> None | str: """Helper function to print a single message""" kwargs["style"] = msg.style return print_msgs([msg], **kwargs) @@ -50,7 +50,7 @@ def print_msgs( style: MsgStyle = MsgStyle.NORMAL, get_input: bool = False, hide_input: bool = False, -) -> Union[None, str]: +) -> None | str: # Same as print_msg, but for a list text = Text("", end="") kwargs = style.decoration.args diff --git a/jrnl/prompt.py b/jrnl/prompt.py index 8150ddb3..8c3323eb 100644 --- a/jrnl/prompt.py +++ b/jrnl/prompt.py @@ -43,7 +43,7 @@ def create_password(journal_name: str) -> str: return pw -def prompt_password(attempts: int, max_attempts: int) -> tuple[int, str | None]: +def prompt_password(attempts: int, max_attempts: int) -> tuple[int, str]: if attempts >= max_attempts: raise JrnlException(Message(MsgText.PasswordMaxTriesExceeded, MsgStyle.ERROR)) @@ -55,7 +55,7 @@ def prompt_password(attempts: int, max_attempts: int) -> tuple[int, str | None]: Message(MsgText.Password, MsgStyle.PROMPT), get_input=True, hide_input=True, - ) + ) or "" def yesno(prompt: Message, default: bool = True) -> bool: