Skip to content

Commit b6a9a05

Browse files
authored
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.
1 parent 464761b commit b6a9a05

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stdlib/2and3/poplib.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from mypy_extensions import NoReturn
44
import socket
55
import ssl
66
import sys
7-
from typing import Any, BinaryIO, Dict, List, Optional, Pattern, Text, Tuple
7+
from typing import Any, BinaryIO, Dict, List, Optional, overload, Pattern, Text, Tuple
88

99
_LongResp = Tuple[bytes, List[bytes], int]
1010

@@ -49,7 +49,12 @@ class POP3:
4949
else:
5050
def apop(self, user: Text, password: Text) -> bytes: ...
5151
def top(self, which: Any, howmuch: int) -> _LongResp: ...
52-
def uidl(self, which: Optional[Any] = ...) -> _LongResp: ...
52+
53+
@overload
54+
def uidl(self) -> _LongResp: ...
55+
@overload
56+
def uidl(self, which: Any) -> bytes: ...
57+
5358
if sys.version_info >= (3, 5):
5459
def utf8(self) -> bytes: ...
5560
if sys.version_info >= (3, 4):

0 commit comments

Comments
 (0)