|
|
|
@ -14,7 +14,7 @@ class BirdError(Exception):
|
|
|
|
|
@dataclass
|
|
|
|
|
class BirdResponse:
|
|
|
|
|
text: str = ''
|
|
|
|
|
codes: list[tuple[tuple[int, int], int]] = [] # List of line ranges (inclusive) and the respective code.
|
|
|
|
|
codes: list[tuple[tuple[int, int], str]] = field(default_factory=list) # List of line ranges (inclusive) and the respective code.
|
|
|
|
|
|
|
|
|
|
def raise_exceptions(self) -> None:
|
|
|
|
|
# If the response contains any errors, raise them as BirdErrors
|
|
|
|
@ -42,7 +42,7 @@ class BirdSocketConnection:
|
|
|
|
|
def request(self, req: str) -> BirdResponse:
|
|
|
|
|
if not req.endswith('\n'):
|
|
|
|
|
req = req + '\n'
|
|
|
|
|
binreq = req,encode()
|
|
|
|
|
binreq = req.encode()
|
|
|
|
|
self.socket.send(binreq)
|
|
|
|
|
return self._parse_response()
|
|
|
|
|
|
|
|
|
|