MCPcopy Create free account
hub / github.com/PRIME-RL/PRIME / should_allow_eval

Function should_allow_eval

data_preprocessing/math_util/__init__.py:191–204  ·  view source on GitHub ↗
(expr: str)

Source from the content-addressed store, hash-verified

189
190
191def should_allow_eval(expr: str):
192 # we don't want to try parsing unknown text or functions of more than two variables
193 if count_unknown_letters_in_expr(expr) > 2:
194 return False
195
196 for bad_string in BAD_SUBSTRINGS:
197 if bad_string in expr:
198 return False
199
200 for bad_regex in BAD_REGEXES:
201 if re.search(bad_regex, expr) is not None:
202 return False
203
204 return True
205
206
207def are_equal_under_sympy(ground_truth_normalized: str, given_normalized: str):

Callers 1

are_equal_under_sympyFunction · 0.70

Calls 1

Tested by

no test coverage detected