Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevn sobolevn commented Oct 28, 2022

  • send calls _socket.sendall
  • append calls MapCRLF.sub(CRLF, message)
>>> import imaplib >>> imaplib.ParseFlags(bytearray()) () >>> imaplib.Internaldate2tuple(bytearray()) >>> 

Source: https://github.com/python/cpython/blob/7ee3aca00a0dffc9cb5906a24005a8c61d5bce14/Lib/imaplib.py
Refs #9006


def Internaldate2tuple(resp: bytes) -> time.struct_time: ...
def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ...
def Int2AP(num: int) -> str: ...
Copy link
Member

@JelleZijlstra JelleZijlstra Oct 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Member Author

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] 😱

Copy link
Member

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 :)

Copy link
Member

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:

first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]],

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@JelleZijlstra JelleZijlstra merged commit 49d3393 into python:master Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants