From b6a9a05743cb9cd5de30111e3d958b8c11f0bc2c Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Mon, 1 May 2017 08:56:27 -0700 Subject: [PATCH] Turn uidl() into an overload. (#1231) The previous change was still right. Unique among `poplib` functions, `uidl()` returns a long response when called without arguments, but just a bytes string when called with a `which` argument. --- stdlib/2and3/poplib.pyi | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/stdlib/2and3/poplib.pyi b/stdlib/2and3/poplib.pyi index 36f6e1d3a..e7e0c36e0 100644 --- a/stdlib/2and3/poplib.pyi +++ b/stdlib/2and3/poplib.pyi @@ -4,7 +4,7 @@ from mypy_extensions import NoReturn import socket import ssl import sys -from typing import Any, BinaryIO, Dict, List, Optional, Pattern, Text, Tuple +from typing import Any, BinaryIO, Dict, List, Optional, overload, Pattern, Text, Tuple _LongResp = Tuple[bytes, List[bytes], int] @@ -49,7 +49,12 @@ class POP3: else: def apop(self, user: Text, password: Text) -> bytes: ... def top(self, which: Any, howmuch: int) -> _LongResp: ... - def uidl(self, which: Optional[Any] = ...) -> _LongResp: ... + + @overload + def uidl(self) -> _LongResp: ... + @overload + def uidl(self, which: Any) -> bytes: ... + if sys.version_info >= (3, 5): def utf8(self) -> bytes: ... if sys.version_info >= (3, 4):