def loads(conditions_string):
""" Deserializes the conditions property into its corresponding
components: the condition_structure and the condition_list.
Args:
conditions_string: String defining valid and/or conditions.
Returns:
A tuple of (condition_structure, condition_list).
condition_structure: nested list of operators and placeholders for operands.
condition_list: list of conditions whose index correspond to the values of the placeholders.
"""
decoder = ConditionDecoder(_audience_condition_deserializer)
# Create a custom JSONDecoder using the ConditionDecoder's object_hook method
# to create the condition_structure as well as populate the condition_list
json_decoder = json.JSONDecoder(object_hook=decoder.object_hook)
# Perform the decoding
condition_structure = json_decoder.decode(conditions_string)
condition_list = decoder.condition_list
return (condition_structure, condition_list)
评论列表
文章目录