(self, pkt, x)
| 1160 | |
| 1161 | class XNBytesField(NBytesField): |
| 1162 | def i2repr(self, pkt, x): |
| 1163 | # type: (Optional[Packet], int) -> str |
| 1164 | if isinstance(x, int): |
| 1165 | return '0x%x' % x |
| 1166 | # x can be a tuple when coming from struct.unpack (from getfield) |
| 1167 | if isinstance(x, (list, tuple)): |
| 1168 | return "0x" + "".join("%02x" % b for b in x) |
| 1169 | return super(XNBytesField, self).i2repr(pkt, x) |
| 1170 | |
| 1171 | |
| 1172 | class SignedByteField(Field[int, int]): |