mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Add missing Optional to str.split and socket.socket. (#504)
* Add Optional to str.split and friends * Python 3: Make fileno arg of socket.socket Optional Python 2: Remove fileno arg of socket.socket
This commit is contained in:
committed by
Guido van Rossum
parent
828f42e350
commit
5e5b3726f2
@@ -238,9 +238,9 @@ class unicode(basestring, Sequence[unicode]):
|
||||
def rindex(self, sub: unicode, start: int = 0, end: int = 0) -> int: ...
|
||||
def rjust(self, width: int, fillchar: unicode = u' ') -> unicode: ...
|
||||
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
|
||||
def rsplit(self, sep: unicode = ..., maxsplit: int = ...) -> List[unicode]: ...
|
||||
def rsplit(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
|
||||
def rstrip(self, chars: unicode = ...) -> unicode: ...
|
||||
def split(self, sep: unicode = ..., maxsplit: int = ...) -> List[unicode]: ...
|
||||
def split(self, sep: Optional[unicode] = ..., maxsplit: int = ...) -> List[unicode]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[unicode]: ...
|
||||
def startswith(self, prefix: Union[unicode, Tuple[unicode, ...]], start: int = 0,
|
||||
end: int = ...) -> bool: ...
|
||||
@@ -318,7 +318,7 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def rpartition(self, sep: unicode) -> Tuple[unicode, unicode, unicode]: ...
|
||||
@overload
|
||||
def rsplit(self, sep: str = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
@overload
|
||||
def rsplit(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
|
||||
@overload
|
||||
@@ -326,7 +326,7 @@ class str(basestring, Sequence[str]):
|
||||
@overload
|
||||
def rstrip(self, chars: unicode) -> unicode: ...
|
||||
@overload
|
||||
def split(self, sep: str = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[str]: ...
|
||||
@overload
|
||||
def split(self, sep: unicode, maxsplit: int = ...) -> List[unicode]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[str]: ...
|
||||
@@ -401,9 +401,9 @@ class bytearray(MutableSequence[int]):
|
||||
def rindex(self, sub: str, start: int = 0, end: int = ...) -> int: ...
|
||||
def rjust(self, width: int, fillchar: str = ...) -> bytearray: ...
|
||||
def rpartition(self, sep: str) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: str = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rsplit(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def rstrip(self, chars: str = ...) -> bytearray: ...
|
||||
def split(self, sep: str = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def split(self, sep: Optional[str] = ..., maxsplit: int = ...) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
|
||||
def startswith(self, prefix: Union[str, Tuple[str, ...]]) -> bool: ...
|
||||
def strip(self, chars: str = ...) -> bytearray: ...
|
||||
|
||||
@@ -278,7 +278,7 @@ class socket:
|
||||
proto = 0
|
||||
|
||||
def __init__(self, family: int = ..., type: int = ...,
|
||||
proto: int = ..., fileno: int = ...) -> None: ...
|
||||
proto: int = ...) -> None: ...
|
||||
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# see: http://hg.python.org/cpython/file/3d0686d90f55/Lib/socket.py
|
||||
# see: http://nullege.com/codes/search/socket
|
||||
|
||||
from typing import Any, Tuple, Union, List, overload
|
||||
from typing import Any, Tuple, List, Optional, Union, overload
|
||||
|
||||
# ----- variables and constants -----
|
||||
|
||||
@@ -277,7 +277,7 @@ class socket:
|
||||
proto = 0
|
||||
|
||||
def __init__(self, family: int = ..., type: int = ...,
|
||||
proto: int = ..., fileno: int = ...) -> None: ...
|
||||
proto: int = ..., fileno: Optional[int] = ...) -> None: ...
|
||||
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
|
||||
Reference in New Issue
Block a user