diff --git a/labgrid/protocol/consoleprotocol.py b/labgrid/protocol/consoleprotocol.py index 3310813a1..70f18c95d 100644 --- a/labgrid/protocol/consoleprotocol.py +++ b/labgrid/protocol/consoleprotocol.py @@ -1,11 +1,14 @@ import abc +from typing import Optional + +from pexpect import EOF, TIMEOUT class ConsoleProtocol(abc.ABC): """Abstract class for the ConsoleProtocol""" @abc.abstractmethod - def read(self): + def read(self, size: int = 1, timeout: float = 0.0, max_size: Optional[int] = None): """ Read data from underlying port """ @@ -24,7 +27,11 @@ def sendline(self, line: str): def sendcontrol(self, char: str): raise NotImplementedError - def expect(self, pattern: str): + def expect( + self, + pattern: str | bytes | type[EOF] | type[TIMEOUT] | list[str | bytes | type[EOF] | type[TIMEOUT]], + timeout: float = -1, + ): raise NotImplementedError class Client(abc.ABC):