From cb684eb16d66a0814ef7e3c9f08706b5058bd690 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 31 Oct 2022 21:43:38 -0700 Subject: [PATCH 1/3] imaplib: _Authenticator also works with bytearray --- stdlib/imaplib.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 54760dd036ca..8b55e5b81414 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -151,10 +151,10 @@ class IMAP4_stream(IMAP4): def open(self, host: str | None = ..., port: int | None = ...) -> None: ... class _Authenticator: - mech: Callable[[bytes], bytes] - def __init__(self, mechinst: Callable[[bytes], bytes]) -> None: ... + mech: Callable[[bytes], bytes | bytearray | None] + def __init__(self, mechinst: Callable[[bytes], bytes | bytearray | None]) -> None: ... def process(self, data: str) -> str: ... - def encode(self, inp: bytes) -> str: ... + def encode(self, inp: bytes | bytearray) -> str: ... def decode(self, inp: str) -> bytes: ... def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ... From 8a08aae28cef6bed590e1eb13a5b2def7e4521c2 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 2 Nov 2022 20:36:46 -0700 Subject: [PATCH 2/3] imaplib: allow more types --- stdlib/imaplib.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 8b55e5b81414..f969b4b40142 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -1,7 +1,7 @@ import subprocess import sys import time -from _typeshed import ReadableBuffer, Self +from _typeshed import _BufferWithLen, ReadableBuffer, Self from builtins import list as _list # conflicts with a method named "list" from collections.abc import Callable from datetime import datetime @@ -151,11 +151,11 @@ class IMAP4_stream(IMAP4): def open(self, host: str | None = ..., port: int | None = ...) -> None: ... class _Authenticator: - mech: Callable[[bytes], bytes | bytearray | None] - def __init__(self, mechinst: Callable[[bytes], bytes | bytearray | None]) -> None: ... + mech: Callable[[bytes], bytes | bytearray | memoryview | str | None] + def __init__(self, mechinst: Callable[[bytes], bytes | bytearray | memoryview | str | None]) -> None: ... def process(self, data: str) -> str: ... - def encode(self, inp: bytes | bytearray) -> str: ... - def decode(self, inp: str) -> bytes: ... + def encode(self, inp: bytes | bytearray | memoryview) -> str: ... + def decode(self, inp: str | _BufferWithLen) -> bytes: ... def Internaldate2tuple(resp: ReadableBuffer) -> time.struct_time | None: ... def Int2AP(num: SupportsAbs[SupportsInt]) -> bytes: ... From c6a6876bbb8f68896e9b315e2f2e269ca16feaa4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 03:38:01 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/imaplib.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index f969b4b40142..f13e1c9b656c 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -1,7 +1,7 @@ import subprocess import sys import time -from _typeshed import _BufferWithLen, ReadableBuffer, Self +from _typeshed import ReadableBuffer, Self, _BufferWithLen from builtins import list as _list # conflicts with a method named "list" from collections.abc import Callable from datetime import datetime