summaryrefslogtreecommitdiff
path: root/shared-bindings/socket
diff options
context:
space:
mode:
authorDavePutz <dwputz@gmail.com>2020-07-24 20:29:53 -0500
committerGitHub <noreply@github.com>2020-07-24 20:29:53 -0500
commit3dfed3c4aa52d06bd2eb1c28d0a1916821cc3f80 (patch)
treee585876c4e4d3500ba42dfceeb11c5bd11e7dd74 /shared-bindings/socket
parenta14101cd137e56002ff0599d99f8234966786454 (diff)
parenta6e048686fe6999c4231582b7d9e69a7dc679257 (diff)
Merge pull request #15 from adafruit/main
update from main
Diffstat (limited to 'shared-bindings/socket')
-rw-r--r--shared-bindings/socket/__init__.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/shared-bindings/socket/__init__.c b/shared-bindings/socket/__init__.c
index 2485d8ef8..a2007edf6 100644
--- a/shared-bindings/socket/__init__.c
+++ b/shared-bindings/socket/__init__.c
@@ -49,7 +49,7 @@ STATIC const mp_obj_type_t socket_type;
//| class socket:
//|
-//| def __init__(self, family: int, type: int, proto: int):
+//| def __init__(self, family: int, type: int, proto: int) -> None:
//| """Create a new socket
//|
//| :param ~int family: AF_INET or AF_INET6
@@ -96,7 +96,7 @@ STATIC void socket_select_nic(mod_network_socket_obj_t *self, const byte *ip) {
}
}
-//| def bind(self, address: tuple) -> Any:
+//| def bind(self, address: tuple) -> None:
//| """Bind a socket to an address
//|
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
@@ -123,7 +123,7 @@ STATIC mp_obj_t socket_bind(mp_obj_t self_in, mp_obj_t addr_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_bind_obj, socket_bind);
-//| def listen(self, backlog: int) -> Any:
+//| def listen(self, backlog: int) -> None:
//| """Set socket to listen for incoming connections
//|
//| :param ~int backlog: length of backlog queue for waiting connetions"""
@@ -148,7 +148,7 @@ STATIC mp_obj_t socket_listen(mp_obj_t self_in, mp_obj_t backlog) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_listen_obj, socket_listen);
-//| def accept(self, ) -> Any:
+//| def accept(self) -> tuple:
//| """Accept a connection on a listening socket of type SOCK_STREAM,
//| creating a new socket of type SOCK_STREAM.
//| Returns a tuple of (new_socket, remote_address)"""
@@ -185,7 +185,7 @@ STATIC mp_obj_t socket_accept(mp_obj_t self_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(socket_accept_obj, socket_accept);
-//| def connect(self, address: tuple) -> Any:
+//| def connect(self, address: tuple) -> None:
//| """Connect a socket to a remote address
//|
//| :param ~tuple address: tuple of (remote_address, remote_port)"""
@@ -212,7 +212,7 @@ STATIC mp_obj_t socket_connect(mp_obj_t self_in, mp_obj_t addr_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_connect_obj, socket_connect);
-//| def send(self, bytes: bytes) -> Any:
+//| def send(self, bytes: bytes) -> int:
//| """Send some bytes to the connected remote address.
//| Suits sockets of type SOCK_STREAM
//|
@@ -249,7 +249,7 @@ STATIC mp_int_t _socket_recv_into(mod_network_socket_obj_t *sock, byte *buf, mp_
}
-//| def recv_into(self, buffer: bytearray, bufsize: int) -> Any:
+//| def recv_into(self, buffer: WriteableBuffer, bufsize: int) -> int:
//| """Reads some bytes from the connected remote address, writing
//| into the provided buffer. If bufsize <= len(buffer) is given,
//| a maximum of bufsize bytes will be read into the buffer. If no
@@ -285,7 +285,7 @@ STATIC mp_obj_t socket_recv_into(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_recv_into_obj, 2, 3, socket_recv_into);
-//| def recv(self, bufsize: int) -> Any:
+//| def recv(self, bufsize: int) -> bytes:
//| """Reads some bytes from the connected remote address.
//| Suits sockets of type SOCK_STREAM
//| Returns a bytes() of length <= bufsize
@@ -312,7 +312,7 @@ STATIC mp_obj_t socket_recv(mp_obj_t self_in, mp_obj_t len_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recv_obj, socket_recv);
-//| def sendto(self, bytes: bytes, address: tuple) -> Any:
+//| def sendto(self, bytes: bytes, address: tuple) -> int:
//| """Send some bytes to a specific address.
//| Suits sockets of type SOCK_DGRAM
//|
@@ -346,7 +346,7 @@ STATIC mp_obj_t socket_sendto(mp_obj_t self_in, mp_obj_t data_in, mp_obj_t addr_
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(socket_sendto_obj, socket_sendto);
-//| def recvfrom(self, bufsize: int) -> Any:
+//| def recvfrom(self, bufsize: int) -> Tuple[bytes, tuple]:
//| """Reads some bytes from the connected remote address.
//| Suits sockets of type SOCK_STREAM
//|
@@ -385,7 +385,7 @@ STATIC mp_obj_t socket_recvfrom(mp_obj_t self_in, mp_obj_t len_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_recvfrom_obj, socket_recvfrom);
-//| def setsockopt(self, level: Any, optname: Any, value: Any) -> Any:
+//| def setsockopt(self, level: int, optname: int, value: int) -> None:
//| """Sets socket options"""
//| ...
//|
@@ -419,7 +419,7 @@ STATIC mp_obj_t socket_setsockopt(size_t n_args, const mp_obj_t *args) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(socket_setsockopt_obj, 4, 4, socket_setsockopt);
-//| def settimeout(self, value: int) -> Any:
+//| def settimeout(self, value: int) -> None:
//| """Set the timeout value for this socket.
//|
//| :param ~int value: timeout in seconds. 0 means non-blocking. None means block indefinitely."""
@@ -450,7 +450,7 @@ STATIC mp_obj_t socket_settimeout(mp_obj_t self_in, mp_obj_t timeout_in) {
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(socket_settimeout_obj, socket_settimeout);
-//| def setblocking(self, flag: bool) -> Any:
+//| def setblocking(self, flag: bool) -> Optional[int]:
//| """Set the blocking behaviour of this socket.
//|
//| :param ~bool flag: False means non-blocking, True means block indefinitely."""
@@ -512,7 +512,7 @@ STATIC const mp_obj_type_t socket_type = {
.locals_dict = (mp_obj_dict_t*)&socket_locals_dict,
};
-//| def getaddrinfo(host: Any, port: Any) -> Any:
+//| def getaddrinfo(host: string, port: string) -> tuple:
//| """Gets the address information for a hostname and port
//|
//| Returns the appropriate family, socket type, socket protocol and