more refactor

This commit is contained in:
xenia 2021-05-12 16:57:49 -04:00
parent 18e161e7d8
commit fd48e10ff4
1 changed files with 8 additions and 2 deletions

View File

@ -111,7 +111,12 @@ async def megacom(tty: str, baud: int, mode: str) -> None:
loop = asyncio.get_event_loop()
keycodes = KeycodeHandler()
return await megacom_main(stdin, stdout, tty, baud, bytesize, parity, stopbits, loop, keycodes)
async def megacom_main(stdin: asyncio.StreamReader, stdout: asyncio.StreamWriter, tty: str,
baud: int, bytesize: Any, parity: Any, stopbits: Any,
loop: asyncio.AbstractEventLoop, keycodes: KeycodeHandler) -> None:
printed_fnf = False
while True:
@ -153,7 +158,7 @@ async def megacom(tty: str, baud: int, mode: str) -> None:
await stdout.drain()
return
stdout.write(f"megacom connected to {tty}:{baud}:{mode}\r\n".encode())
stdout.write(f"megacom connected to {tty}\r\n".encode())
await stdout.drain()
async def connect_pipe(pin: asyncio.StreamReader, pout: asyncio.StreamWriter,
@ -216,7 +221,8 @@ async def megacom(tty: str, baud: int, mode: str) -> None:
await stdout.drain()
if do_retry:
return await megacom(tty, baud, mode)
return await megacom_main(stdin, stdout, tty, baud, bytesize, parity, stopbits, loop,
keycodes)
def main() -> None: