@@ -93,8 +93,6 @@ def getaddrinfo(
93
93
:param int proto: Unused in this implementation of socket.
94
94
:param int flags: Unused in this implementation of socket.
95
95
"""
96
- # TODO: Python socket accepts port as a string or int or None. How are str and None handled?
97
- # TODO: Python socket has arg type in place of socktype.
98
96
if not isinstance (port , int ):
99
97
raise RuntimeError ("Port must be an integer" )
100
98
if is_ipv4 (host ):
@@ -322,7 +320,6 @@ def accept(
322
320
self ._socknum = new_listen_socknum # pylint: disable=protected-access
323
321
self .bind ((None , self ._listen_port ))
324
322
self .listen ()
325
- # TODO: Weird logic below. Should be an if, not a while
326
323
while self .status != wiznet5k .adafruit_wiznet5k .SNSR_SOCK_LISTEN :
327
324
raise RuntimeError ("Failed to open new listening socket" )
328
325
return client_sock , addr
@@ -340,7 +337,6 @@ def connect(
340
337
:param Optional[int] conntype: Raises an exception if set to 3, unused otherwise, defaults
341
338
to None.
342
339
"""
343
- # TODO: conntype unused beyond raising an exception.
344
340
assert (
345
341
conntype != 0x03
346
342
), "Error: SSL/TLS is not currently supported by CircuitPython."
@@ -380,7 +376,7 @@ def sendto(self, data: bytearray, address: [Tuple[str, int]]) -> None:
380
376
:param tuple address: Remote socket as a (host, port) tuple.
381
377
"""
382
378
self .connect (address )
383
- return self .send (data ) # TODO: send only returns None, so can delete
379
+ return self .send (data )
384
380
385
381
def recv (
386
382
# pylint: disable=too-many-branches
@@ -431,17 +427,15 @@ def recv(
431
427
elif self ._sock_type == SOCK_DGRAM :
432
428
recv = _the_interface .read_udp (self .socknum , min (to_read , avail ))[1 ]
433
429
to_read = len (recv ) # only get this dgram
434
- recv = bytes (
435
- recv
436
- ) # TODO: Maybe raise a specific exception before this line
430
+ recv = bytes (recv )
437
431
received .append (recv )
438
432
to_read -= len (recv )
439
433
gc .collect ()
440
434
if self ._timeout > 0 and time .monotonic () - stamp > self ._timeout :
441
435
break
442
436
self ._buffer += b"" .join (received )
443
437
444
- ret = None # TODO: Unused definition
438
+ ret = None
445
439
if len (self ._buffer ) == bufsize :
446
440
ret = self ._buffer
447
441
self ._buffer = b""
@@ -463,9 +457,8 @@ def embed_recv(
463
457
464
458
:return bytes: All data available from the connection.
465
459
"""
466
- # TODO: bufsize unused
467
460
# print("Socket read", bufsize)
468
- ret = None # TODO: Useless definition
461
+ ret = None
469
462
avail = self .available ()
470
463
if avail :
471
464
if self ._sock_type == SOCK_STREAM :
0 commit comments