ikvk / imap_tools

Work with email by IMAP
Apache License 2.0
721 stars 83 forks source link

mypy errors because of `_lru_cache_wrapper` in v1.2.0 #208

Closed hofrob closed 1 year ago

hofrob commented 1 year ago

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: https://github.com/python/mypy/issues/5858

This affects all usages of

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)
ikvk commented 1 year ago

https://github.com/python/mypy/issues/5858 seems closed and resolved. Let me know about bugs if in needs.