Improve prettyfied string of PDUs
@@ -147,7 +147,7 @@ class PDU(Type[Any]):
"""
prefix = " " * depth
lines = [
- f"{prefix}{self.__class__.__name__}",
+ f"{prefix}{self.__class__.__name__} (tag: {self.TAG})",
f"{prefix} Request ID: {self.request_id}",
f"{prefix} Error Status: {self.error_status}",
f"{prefix} Error Index: {self.error_index}",
@@ -304,14 +304,18 @@ class BulkGetRequest(Type[Any]):
"""
prefix = " " * depth
lines = [
- self.__class__.__name__,
+ f"{prefix}{self.__class__.__name__} (tag: {self.TAG})",
f"{prefix} Request ID: {self.request_id}",
f"{prefix} Non Repeaters: {self.non_repeaters}",
f"{prefix} Max Repeaters: {self.max_repeaters}",
f"{prefix} Varbinds: ",
]
+ if self.varbinds:
+ lines.append(f"{prefix} Varbinds: ")
for bind in self.varbinds:
lines.append(f"{prefix} {bind.oid}: {bind.value}")
+ else:
+ lines.append(f"{prefix} Varbinds: <none>")
return "\n".join(lines)
