19
19
from typing import Optional
20
20
except ImportError :
21
21
pass
22
- from circuitpython_typing import ReadableBuffer
22
+ from circuitpython_typing import ReadableBuffer , WriteableBuffer
23
23
24
24
__version__ = "0.0.0-auto.0"
25
25
__repo__ = (
@@ -50,7 +50,7 @@ class TransparentUARTService(Service):
50
50
buffer_size = 64 ,
51
51
)
52
52
53
- def __init__ (self , service : Optional [Service ] = None ):
53
+ def __init__ (self , service : Optional ["TransparentUARTService" ] = None ):
54
54
super ().__init__ (service = service )
55
55
self .connectable = True
56
56
if not service :
@@ -61,7 +61,7 @@ def __init__(self, service: Optional[Service] = None):
61
61
self ._tx = self ._server_rx
62
62
self ._rx = self ._server_tx
63
63
64
- def read (self , nbytes : Optional [bytes ] = None ) -> Optional [bytes ]:
64
+ def read (self , nbytes : Optional [int ] = None ) -> Optional [bytes ]:
65
65
"""
66
66
Read characters. If ``nbytes`` is specified then read at most that many bytes.
67
67
Otherwise, read everything that arrives until the connection times out.
@@ -72,7 +72,9 @@ def read(self, nbytes: Optional[bytes] = None) -> Optional[bytes]:
72
72
"""
73
73
return self ._rx .read (nbytes )
74
74
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 ]:
76
78
"""
77
79
Read bytes into the ``buf``. If ``nbytes`` is specified then read at most
78
80
that many bytes. Otherwise, read at most ``len(buf)`` bytes.
0 commit comments