mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-03-22 10:38:37 +00:00
utils/serializer: fix level deserialization
Fix a regression introduced with Python 3 port -- JSON deserializer should check for basestring rather than str when deciding whether to try to decode a custom type.
This commit is contained in:
parent
b6531feb52
commit
657a10c09d
@ -50,6 +50,8 @@ from datetime import datetime
|
|||||||
import yaml as _yaml
|
import yaml as _yaml
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
|
||||||
|
from past.builtins import basestring
|
||||||
|
|
||||||
from wa.framework.exception import SerializerSyntaxError
|
from wa.framework.exception import SerializerSyntaxError
|
||||||
from wa.utils.misc import isiterable
|
from wa.utils.misc import isiterable
|
||||||
from wa.utils.types import regex_type, none_type, level, cpu_mask
|
from wa.utils.types import regex_type, none_type, level, cpu_mask
|
||||||
@ -104,7 +106,7 @@ class WAJSONDecoder(_json.JSONDecoder):
|
|||||||
d = _json.JSONDecoder.decode(self, s, **kwargs)
|
d = _json.JSONDecoder.decode(self, s, **kwargs)
|
||||||
|
|
||||||
def try_parse_object(v):
|
def try_parse_object(v):
|
||||||
if isinstance(v, str):
|
if isinstance(v, basestring):
|
||||||
if v.startswith('REGEX:'):
|
if v.startswith('REGEX:'):
|
||||||
_, flags, pattern = v.split(':', 2)
|
_, flags, pattern = v.split(':', 2)
|
||||||
return re.compile(pattern, int(flags or 0))
|
return re.compile(pattern, int(flags or 0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user