MCPcopy Create free account
hub / github.com/EasyIME/PIME / _decode_fields_v2

Function _decode_fields_v2

python/python3/tornado/web.py:3536–3553  ·  view source on GitHub ↗
(value: bytes)

Source from the content-addressed store, hash-verified

3534
3535
3536def _decode_fields_v2(value: bytes) -> Tuple[int, bytes, bytes, bytes, bytes]:
3537 def _consume_field(s: bytes) -> Tuple[bytes, bytes]:
3538 length, _, rest = s.partition(b":")
3539 n = int(length)
3540 field_value = rest[:n]
3541 # In python 3, indexing bytes returns small integers; we must
3542 # use a slice to get a byte string as in python 2.
3543 if rest[n : n + 1] != b"|":
3544 raise ValueError("malformed v2 signed value field")
3545 rest = rest[n + 1 :]
3546 return field_value, rest
3547
3548 rest = value[2:] # remove version number
3549 key_version, rest = _consume_field(rest)
3550 timestamp, rest = _consume_field(rest)
3551 name_field, rest = _consume_field(rest)
3552 value_field, passed_sig = _consume_field(rest)
3553 return int(key_version), timestamp, name_field, value_field, passed_sig
3554
3555
3556def _decode_signed_value_v2(

Callers 2

_decode_signed_value_v2Function · 0.85

Calls 1

_consume_fieldFunction · 0.85

Tested by

no test coverage detected