From c4c6b4e7c17e5b96d86828a3bc809a1c6c9559df Mon Sep 17 00:00:00 2001 From: Yuval Adam Date: Thu, 24 Mar 2016 22:24:43 +0200 Subject: Extract parse_const --- viewstate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'viewstate.py') diff --git a/viewstate.py b/viewstate.py index bf14005..b75cd37 100644 --- a/viewstate.py +++ b/viewstate.py @@ -9,10 +9,13 @@ CONSTS = { 104: False } +def parse_const(b): + return CONSTS.get(b, None) + def parse(b): assert type(b) == bytes().__class__ - if len(b) == 1 and b[0] in CONSTS: - return CONSTS[b[0]] + if len(b) == 1: + return parse_const(b[0]) return None -- cgit v1.3.1