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

Function _get_version

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

Source from the content-addressed store, hash-verified

3445
3446
3447def _get_version(value: bytes) -> int:
3448 # Figures out what version value is. Version 1 did not include an
3449 # explicit version field and started with arbitrary base64 data,
3450 # which makes this tricky.
3451 m = _signed_value_version_re.match(value)
3452 if m is None:
3453 version = 1
3454 else:
3455 try:
3456 version = int(m.group(1))
3457 if version > 999:
3458 # Certain payloads from the version-less v1 format may
3459 # be parsed as valid integers. Due to base64 padding
3460 # restrictions, this can only happen for numbers whose
3461 # length is a multiple of 4, so we can treat all
3462 # numbers up to 999 as versions, and for the rest we
3463 # fall back to v1 format.
3464 version = 1
3465 except ValueError:
3466 version = 1
3467 return version
3468
3469
3470def decode_signed_value(

Callers 2

decode_signed_valueFunction · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected