-
-
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: fix bytes usage #9021
imaplib: fix bytes usage #9021
Conversation
stdlib/imaplib.pyi
Outdated
@@ -157,7 +157,7 @@ class _Authenticator: | |||
def encode(self, inp: bytes) -> str: ... | |||
def decode(self, inp: str) -> bytes: ... | |||
|
|||
def Internaldate2tuple(resp: bytes) -> time.struct_time: ... | |||
def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ... | |||
def Int2AP(num: int) -> str: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def Int2AP(num: int) -> str: ... | |
def Int2AP(num: int) -> bytes: ... |
Not directly related but this one definitely returns bytes. We could also change the arg type to SupportsAbs
I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure! It is num = int(abs(num))
: SupportsAbs[SupportsInt]
😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still got to fix the return type :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sure! It is
num = int(abs(num))
:SupportsAbs[SupportsInt]
😱
Could be worse:
typeshed/stdlib/unittest/case.pyi
Line 219 in b5c4580
first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
send
calls_socket.sendall
append
callsMapCRLF.sub(CRLF, message)
Source: https://github.com/python/cpython/blob/7ee3aca00a0dffc9cb5906a24005a8c61d5bce14/Lib/imaplib.py
Refs #9006