|
|
@ -14,7 +14,7 @@ class BirdError(Exception):
|
|
|
|
@dataclass
|
|
|
|
@dataclass
|
|
|
|
class BirdResponse:
|
|
|
|
class BirdResponse:
|
|
|
|
text: str = ''
|
|
|
|
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:
|
|
|
|
def raise_exceptions(self) -> None:
|
|
|
|
# If the response contains any errors, raise them as BirdErrors
|
|
|
|
# If the response contains any errors, raise them as BirdErrors
|
|
|
@ -42,7 +42,7 @@ class BirdSocketConnection:
|
|
|
|
def request(self, req: str) -> BirdResponse:
|
|
|
|
def request(self, req: str) -> BirdResponse:
|
|
|
|
if not req.endswith('\n'):
|
|
|
|
if not req.endswith('\n'):
|
|
|
|
req = req + '\n'
|
|
|
|
req = req + '\n'
|
|
|
|
binreq = req,encode()
|
|
|
|
binreq = req.encode()
|
|
|
|
self.socket.send(binreq)
|
|
|
|
self.socket.send(binreq)
|
|
|
|
return self._parse_response()
|
|
|
|
return self._parse_response()
|
|
|
|
|
|
|
|
|
|
|
|