Upload utils.py with huggingface_hub
Browse files106 unmodified lines107108109110111112113114115106 unmodified linesexecute arbitrary code. The function attempts to mitigate security risksby restricting the available tokens and not exposing built-in functions."""allowd_sub_strings = list(context.keys()) + allowed_tokensif is_made_of_sub_strings(expression, allowd_sub_strings):return eval(expression, {"__builtins__": {}}, context)raise ValueError(f"The expression '{expression}' can not be evaluated because it contains tokens outside the allowed list of {allowd_sub_strings}.")106 unmodified lines107108109110111112113114115106 unmodified linesexecute arbitrary code. The function attempts to mitigate security risksby restricting the available tokens and not exposing built-in functions."""allowed_sub_strings = list(context.keys()) + allowed_tokensif is_made_of_sub_strings(expression, allowed_sub_strings):return eval(expression, {"__builtins__": {}}, context)raise ValueError(f"The expression '{expression}' can not be evaluated because it contains tokens outside the allowed list of {allowed_sub_strings}.")
utils.py+3-3