mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
putting @overload decorator back to getsockopt method
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# see: http://nullege.com/codes/search/socket
|
||||
# adapted for Python 2.7 by Michal Pokorny
|
||||
|
||||
from typing import Any, Tuple, overload, List, Optional, Union
|
||||
from typing import Any, Tuple, List, Optional, Union, overload
|
||||
|
||||
# ----- variables and constants -----
|
||||
|
||||
@@ -283,24 +283,10 @@ class socket:
|
||||
# --- methods ---
|
||||
# second tuple item is an address
|
||||
def accept(self) -> Tuple['socket', Any]: ...
|
||||
|
||||
@overload
|
||||
def bind(self, address: tuple) -> None: ...
|
||||
@overload
|
||||
def bind(self, address: str) -> None: ...
|
||||
|
||||
def bind(self, address: Union[tuple, str]) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def connect(self, address: tuple) -> None: ...
|
||||
@overload
|
||||
def connect(self, address: str) -> None: ...
|
||||
|
||||
@overload
|
||||
def connect_ex(self, address: tuple) -> int: ...
|
||||
@overload
|
||||
def connect_ex(self, address: str) -> int: ...
|
||||
|
||||
def connect(self, address: Union[tuple, str]) -> None: ...
|
||||
def connect_ex(self, address: Union[tuple, str]) -> int: ...
|
||||
def detach(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
@@ -309,9 +295,9 @@ class socket:
|
||||
def getsockname(self) -> Any: ...
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str) -> str: ...
|
||||
def getsockopt(self, level: int, optname: str) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str, buflen: int) -> str: ...
|
||||
def getsockopt(self, level: int, optname: str, buflen: int) -> bytes: ...
|
||||
|
||||
def gettimeout(self) -> float: ...
|
||||
def ioctl(self, control: object,
|
||||
@@ -333,21 +319,11 @@ class socket:
|
||||
def send(self, data: str, flags=...) -> int: ...
|
||||
def sendall(self, data: str, flags=...) -> Any:
|
||||
... # return type: None on success
|
||||
|
||||
@overload
|
||||
def sendto(self, data: str, address: tuple, flags: int = ...) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: str, address: str, flags: int = ...) -> int: ...
|
||||
|
||||
def sendto(self, data: str, address: Union[tuple, str], flags: int = ...) -> int: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
# TODO None valid for the value argument
|
||||
def settimeout(self, value: float) -> None: ...
|
||||
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: str, value: int) -> None: ...
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: str, value: str) -> None: ...
|
||||
|
||||
def setsockopt(self, level: int, optname: str, value: Union[int, str]) -> None: ...
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
from typing import Any, Tuple, Union, List, overload
|
||||
|
||||
# ----- variables and constants -----
|
||||
|
||||
@@ -292,7 +292,12 @@ class socket:
|
||||
# return value is an address
|
||||
def getpeername(self) -> Any: ...
|
||||
def getsockname(self) -> Any: ...
|
||||
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: str, buflen: int) -> bytes: ...
|
||||
|
||||
def gettimeout(self) -> float: ...
|
||||
def ioctl(self, control: object,
|
||||
option: Tuple[int, int, int]) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user