:param packet.Packet pkt: the packet instance containing this field instance. # noqa: E501 :param str x: the string to parse. :return: HPackStringsInterface: the internal type of the value parsed from x. # noqa: E501 :raises: AssertionError :raises: Invalid
(self, pkt, x)
| 1250 | return HPackLiteralString(x) |
| 1251 | |
| 1252 | def m2i(self, pkt, x): |
| 1253 | # type: (packet.Packet, str) -> HPackStringsInterface |
| 1254 | """ |
| 1255 | :param packet.Packet pkt: the packet instance containing this field instance. # noqa: E501 |
| 1256 | :param str x: the string to parse. |
| 1257 | :return: HPackStringsInterface: the internal type of the value parsed from x. # noqa: E501 |
| 1258 | :raises: AssertionError |
| 1259 | :raises: InvalidEncodingException |
| 1260 | :raises: KeyError if _type_from is not one of pkt fields. |
| 1261 | """ |
| 1262 | t = pkt.getfieldval(self._type_from) |
| 1263 | tmp_len = self._length_from(pkt) |
| 1264 | |
| 1265 | assert t is not None and tmp_len is not None, 'Conversion from string impossible: no type or length specified' # noqa: E501 |
| 1266 | |
| 1267 | return self._parse(t == 1, x[:tmp_len]) |
| 1268 | |
| 1269 | def any2i(self, pkt, x): |
| 1270 | # type: (Optional[packet.Packet], Union[str, HPackStringsInterface]) -> HPackStringsInterface # noqa: E501 |
no test coverage detected