-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imaplib: Avoid an unnecessary Any
in CommandResults (#3654)
#3655
Conversation
Could you fix the CI failure? Also, this change is problematic because it introduces a Union in a return type (as mentioned under https://github.com/python/typeshed/blob/master/CONTRIBUTING.md#conventions), so it may be better to stick with Any. |
852f775
to
3725843
Compare
I've just pushed a fix for the CI, if i'm reading it right. I'm not convinced from reading the discussion in python/mypy#1693 that But i'm happy to leave this decision up to the typeshed project -- if you think it's not an improvement, feel free to close this ticket. But if you do, i'd appreciate a clearer explanation of why |
If I understand the documentation and the quick looks at the code correctly, each command always returns either |
@srittau, i like the idea that you're suggesting, and it might work for some functions, but in practice that's not the behavior that i'm seeing from For example, in response to
So maybe we can mark some functions without the union, but i'm not sure that all of them will work that way. |
Mark CommandResults as obsolete. Also fix types of tagged_commands and untagged_responses. Based on a discussion in python#3655.
I looked into it a bit more. For some commands the return value is well known. For example, I opened #3670 to make a few example changes based on this. |
* Improve imaplib return types Mark CommandResults as obsolete. Also fix types of tagged_commands and untagged_responses. Based on a discussion in #3655. * Fix type of tagged_commands * Fix IMAP4.tagged_commands type * Mark CommandResults as private * Fix
I am going to close this, based on the discussion above. Thank you for the contribution! |
This addresses #3654