Skip to content

Commit f4478ce

Browse files
committed
remove cast to support recv_into
1 parent b151039 commit f4478ce

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

adafruit_requests.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,10 @@
4141

4242
import json as json_module
4343

44-
if sys.implementation.name == "circuitpython":
45-
46-
def cast(_t, value):
47-
"""No-op shim for the typing.cast() function which is not available in CircuitPython."""
48-
return value
49-
50-
else:
44+
if not sys.implementation.name == "circuitpython":
5145
from ssl import SSLContext
5246
from types import ModuleType, TracebackType
53-
from typing import Any, Dict, Optional, Tuple, Type, Union, cast
47+
from typing import Any, Dict, Optional, Tuple, Type, Union
5448

5549
try:
5650
from typing import Protocol
@@ -215,7 +209,7 @@ def __exit__(
215209
self.close()
216210

217211
def _recv_into(self, buf: bytearray, size: int = 0) -> int:
218-
return cast("SupportsRecvInto", self.socket).recv_into(buf, size)
212+
return self.socket.recv_into(buf, size)
219213

220214
def _readto(self, stop: bytes) -> bytearray:
221215
buf = self._receive_buffer

0 commit comments

Comments
 (0)