def do_filter2(result, text): comparator = get_comparator(text) if comparator: text = split_and_strip(text, comparator) context = dict(result=result) value = parse_dollar(context, text) # filter_result = eval(str(text), {}, context) # if is_expr(text): # assert eval(text, {}, dict(result=result)) # return result return text
def parse_args(context: dict, *args): return [parse_dollar(context, arg) for arg in args]
def parse_kwargs(context: dict, **kwargs): return { parse_dollar(context, key): parse_dollar(context, value) for key, value in kwargs.items() }
def test_util_parse(): context = {'a': 1} assert parse_dollar(context, 'hello,$a') == 'hello,1'