eqdisco.expr.check_safe_text#

eqdisco.expr.check_safe_text(text, names)[source]#

Reject text that is not a plain arithmetic expression over known names.

SymPy parses strings with Python’s eval; to make parsing of untrusted text (proposals of a language model, files) safe, only digits, operators, parentheses, commas and identifiers from names and the known functions are accepted. Raises ValueError otherwise.