| 3450 | return "%s/%i" % (pfx, pfxlen) |
| 3451 | |
| 3452 | def i2m(self, |
| 3453 | pkt, # type: Optional[Packet] |
| 3454 | x # type: Optional[Tuple[str, int]] |
| 3455 | ): |
| 3456 | # type: (...) -> Tuple[bytes, int] |
| 3457 | # ("fc00:1::1", 64) -> (b"\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) # noqa: E501 |
| 3458 | if x is None: |
| 3459 | pfx, pfxlen = "", 0 |
| 3460 | else: |
| 3461 | (pfx, pfxlen) = x |
| 3462 | s = self.aton(pfx) |
| 3463 | return (s[:self._numbytes(pfxlen)], pfxlen) |
| 3464 | |
| 3465 | def m2i(self, pkt, x): |
| 3466 | # type: (Optional[Packet], Tuple[bytes, int]) -> Tuple[str, int] |