Skip to content

Commit b853e88

Browse files
committed
fix nbytes types, read into writeable buffer
1 parent 585ef0c commit b853e88

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

adafruit_ble_berrymed_pulse_oximeter/adafruit_ble_transparent_uart.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from typing import Optional
2020
except ImportError:
2121
pass
22-
from circuitpython_typing import ReadableBuffer
22+
from circuitpython_typing import ReadableBuffer, WriteableBuffer
2323

2424
__version__ = "0.0.0-auto.0"
2525
__repo__ = (
@@ -50,7 +50,7 @@ class TransparentUARTService(Service):
5050
buffer_size=64,
5151
)
5252

53-
def __init__(self, service: Optional[Service] = None):
53+
def __init__(self, service: Optional["TransparentUARTService"] = None):
5454
super().__init__(service=service)
5555
self.connectable = True
5656
if not service:
@@ -61,7 +61,7 @@ def __init__(self, service: Optional[Service] = None):
6161
self._tx = self._server_rx
6262
self._rx = self._server_tx
6363

64-
def read(self, nbytes: Optional[bytes] = None) -> Optional[bytes]:
64+
def read(self, nbytes: Optional[int] = None) -> Optional[bytes]:
6565
"""
6666
Read characters. If ``nbytes`` is specified then read at most that many bytes.
6767
Otherwise, read everything that arrives until the connection times out.
@@ -72,7 +72,9 @@ def read(self, nbytes: Optional[bytes] = None) -> Optional[bytes]:
7272
"""
7373
return self._rx.read(nbytes)
7474

75-
def readinto(self, buf: bytes, nbytes: Optional[bytes] = None) -> Optional[int]:
75+
def readinto(
76+
self, buf: WriteableBuffer, nbytes: Optional[int] = None
77+
) -> Optional[int]:
7678
"""
7779
Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
7880
that many bytes. Otherwise, read at most ``len(buf)`` bytes.

0 commit comments

Comments
 (0)