Skip to content

Conversation

@wieso-itzi
Copy link

typing.Pattern is a deprecated alias since version 3.9 as per: https://docs.python.org/3/library/typing.html#typing.Pattern that was supposed to represent the return type of re.compile().

It was used in the definitions of IMAP4ClientProtocol.wait and IMAP4.list

In IMAP4.list I found out through manual testing that it expects a Literal, even though my linter bugged me about it due to the Pattern type hint.

In IMAP4ClientProtocol.wait the first line runs re.compile on the parameter that is type-hinted as Pattern, therefore it must also take a Literal and not a Pattern.

I think it would reduce confusion when using the module if we replaced these type hints with the correct types. Having them there doesn't necessarily make it so the code doesn't run, but it definitely took me some time to look and find out what was wrong that could be avoided by future users of the library.

Thanks & kind regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant