15
15
from __future__ import annotations
16
16
17
17
try :
18
- from typing import TYPE_CHECKING , Any , Optional , Tuple , List , Union
18
+ from typing import TYPE_CHECKING , Optional , Tuple , List , Union
19
19
20
20
if TYPE_CHECKING :
21
21
from adafruit_wiznet5k .adafruit_wiznet5k import WIZNET5K
@@ -149,17 +149,17 @@ def __init__(
149
149
self ,
150
150
family : int = AF_INET ,
151
151
type : int = SOCK_STREAM ,
152
- proto : Any = 0 ,
152
+ proto : int = 0 ,
153
153
fileno : Optional [int ] = None ,
154
154
socknum : Optional [int ] = None ,
155
155
) -> None :
156
156
"""
157
157
:param int family: Socket address (and protocol) family, defaults to AF_INET.
158
158
:param int type: Socket type, use SOCK_STREAM for TCP and SOCK_DGRAM for UDP,
159
159
defaults to SOCK_STREAM.
160
- :param Any proto: Unused, retained for compatibility.
161
- :param Optional[Any ] fileno: Unused, retained for compatibility.
162
- :param Optional[Any ] socknum: Unused, retained for compatibility.
160
+ :param int proto: Unused, retained for compatibility.
161
+ :param Optional[int ] fileno: Unused, retained for compatibility.
162
+ :param Optional[int ] socknum: Unused, retained for compatibility.
163
163
"""
164
164
if family != AF_INET :
165
165
raise RuntimeError ("Only AF_INET family supported by W5K modules." )
@@ -277,11 +277,11 @@ def bind(self, address: Tuple[Optional[str], int]) -> None:
277
277
)
278
278
self ._buffer = b""
279
279
280
- def listen (self , backlog : Optional [Any ] = None ) -> None :
280
+ def listen (self , backlog : Optional [int ] = None ) -> None :
281
281
"""
282
282
Listen on the port specified by bind.
283
283
284
- :param Optional[Any ] backlog: Included for compatibility but ignored.
284
+ :param Optional[int ] backlog: Included for compatibility but ignored.
285
285
"""
286
286
assert self ._listen_port is not None , "Use bind to set the port before listen!"
287
287
_the_interface .socket_listen (self .socknum , self ._listen_port )
@@ -385,7 +385,7 @@ def recv(
385
385
# pylint: disable=too-many-branches
386
386
self ,
387
387
bufsize : int = 0 ,
388
- flags : Any = 0 ,
388
+ flags : int = 0 ,
389
389
) -> bytes :
390
390
"""
391
391
Read from the connected remote address.
@@ -451,7 +451,7 @@ def recv(
451
451
return ret
452
452
453
453
def embed_recv (
454
- self , bufsize : int = 0 , flags : Any = 0
454
+ self , bufsize : int = 0 , flags : int = 0
455
455
) -> bytes : # pylint: disable=too-many-branches
456
456
"""
457
457
Read from the connected remote address.
@@ -478,13 +478,13 @@ def embed_recv(
478
478
return ret
479
479
480
480
def recvfrom (
481
- self , bufsize : int = 0 , flags : Any = 0
481
+ self , bufsize : int = 0 , flags : int = 0
482
482
) -> Tuple [bytes , Tuple [str , int ]]:
483
483
"""
484
484
Read some bytes from the connected remote address.
485
485
486
486
:param int bufsize: Maximum number of bytes to receive.
487
- :param Any flags: ignored, present for compatibility.
487
+ :param int flags: ignored, present for compatibility.
488
488
489
489
:return Tuple[bytes, Tuple[str, int]]: a tuple (bytes, address)
490
490
where address is a tuple (ip, port)
@@ -497,13 +497,13 @@ def recvfrom(
497
497
),
498
498
)
499
499
500
- def recv_into (self , buf : bytearray , nbytes : int = 0 , flags : Any = 0 ) -> int :
500
+ def recv_into (self , buf : bytearray , nbytes : int = 0 , flags : int = 0 ) -> int :
501
501
"""
502
502
Read from the connected remote address into the provided buffer.
503
503
504
504
:param bytearray buf: Data buffer
505
505
:param nbytes: Maximum number of bytes to receive
506
- :param Any flags: ignored, present for compatibility.
506
+ :param int flags: ignored, present for compatibility.
507
507
508
508
:return int: the number of bytes received
509
509
"""
@@ -515,7 +515,7 @@ def recv_into(self, buf: bytearray, nbytes: int = 0, flags: Any = 0) -> int:
515
515
return nbytes
516
516
517
517
def recvfrom_into (
518
- self , buf : bytearray , nbytes : int = 0 , flags : Any = 0
518
+ self , buf : bytearray , nbytes : int = 0 , flags : int = 0
519
519
) -> Tuple [int , Tuple [str , int ]]:
520
520
"""
521
521
Read some bytes from the connected remote address into the provided buffer.
@@ -540,7 +540,7 @@ def readline(self) -> bytes:
540
540
Read a line from the socket.
541
541
542
542
Attempt to return as many bytes as we can up to but not including a carriage return and
543
- linefeed charater pair.
543
+ linefeed character pair.
544
544
545
545
:return bytes: The data read from the socket.
546
546
"""
0 commit comments