Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions serial_asyncio_fast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class SerialTransport(asyncio.Transport):
calling you back when it succeeds.
"""

_loop: asyncio.AbstractEventLoop
_serial: serial.Serial
_protocol: asyncio.Protocol

def __init__(
self,
loop: asyncio.AbstractEventLoop,
Expand Down Expand Up @@ -597,7 +601,7 @@ async def open_serial_connection(
if loop is None:
loop = asyncio.get_event_loop()
if limit is None:
limit = asyncio.streams._DEFAULT_LIMIT
limit = 2 ** 16 # 64 KiB
reader = asyncio.StreamReader(limit=limit, loop=loop)
protocol = asyncio.StreamReaderProtocol(reader, loop=loop)
transport, _ = await create_serial_connection(
Expand All @@ -612,9 +616,11 @@ async def open_serial_connection(
if __name__ == "__main__":

class Output(asyncio.Protocol):

_transport: SerialTransport

def __init__(self):
super().__init__()
self._transport = None

def connection_made(self, transport):
self._transport = transport
Expand Down