ikvk / imap_tools

Work with email by IMAP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mypy errors because of `_lru_cache_wrapper` in v1.2.0

hofrob opened this issue · comments

When updating from 1.0.0 to 1.2.0 we're seeing all kinds of mypy errors in our code base:

error: "_lru_cache_wrapper[EmailAddress | None]" has no attribute "name" [attr-defined]

At the moment, I'm not sure if this even needs to be fixed in this library, or is related to how we're using it. I found this open issue on mypy's tracker: python/mypy#5858

This affects all usages of

  • EmailAddress
  • MailAttachment
  • BaseMailBox

example

import imap_tools


def attachments(message: imap_tools.MailMessage) -> None:
    for attachment in message.attachments:
        ...

result

$ mypy main.py 
main.py:4: error: "_lru_cache_wrapper[list[MailAttachment]]" has no attribute "__iter__" (not iterable)  [attr-defined]
Found 1 error in 1 file (checked 1 source file)

python/mypy#5858 seems closed and resolved. Let me know about bugs if in needs.