Skip to content

mypy errors because of _lru_cache_wrapper in v1.2.0 #208

Closed
@hofrob

Description

@hofrob

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)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions