From 283e49b1ee037ed939b75865692de9166caa0050 Mon Sep 17 00:00:00 2001 From: stumpylog <797416+stumpylog@users.noreply.github.com> Date: Tue, 22 Sep 2026 09:24:28 -0700 Subject: [PATCH] Match get_mailbox annotations to what callers actually pass get_mailbox declared port and security as always-present types, but MailAccount.imap_port is nullable and imap_security is stored as a plain integer, so type checking flagged every call site as passing the wrong type. Widen the annotations to port: int | None and security: int, matching the model fields; IntegerChoices members still compare equal to plain ints, so the existing branching in get_mailbox is unaffected. Co-Authored-By: Claude Opus 5 --- src/paperless_mail/mail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/paperless_mail/mail.py b/src/paperless_mail/mail.py index c237fc73c..44dafee02 100644 --- a/src/paperless_mail/mail.py +++ b/src/paperless_mail/mail.py @@ -533,8 +533,8 @@ class PinnedMailBoxStartTls(PinnedClientMixin, MailBoxStartTls): def get_mailbox( server: str, - port: int, - security: MailAccount.ImapSecurity, + port: int | None, + security: int, ) -> MailBox: """ Returns the correct MailBox instance for the given configuration.