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

Function _consume_field

python/python3/tornado/web.py:3537–3546  ·  view source on GitHub ↗
(s: bytes)

Source from the content-addressed store, hash-verified

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)

Callers 1

_decode_fields_v2Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected