Spaces:
Running
Running
MilesCranmer
commited on
fix: deal with edgecase in sympify
Browse files- pysr/export_sympy.py +6 -1
pysr/export_sympy.py
CHANGED
@@ -87,7 +87,12 @@ def pysr2sympy(
|
|
87 |
**sympy_mappings,
|
88 |
}
|
89 |
|
90 |
-
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
|
93 |
def assert_valid_sympy_symbol(var_name: str) -> None:
|
|
|
87 |
**sympy_mappings,
|
88 |
}
|
89 |
|
90 |
+
try:
|
91 |
+
return sympify(equation, locals=local_sympy_mappings, evaluate=False)
|
92 |
+
except TypeError as e:
|
93 |
+
if "got an unexpected keyword argument 'evaluate'" in str(e):
|
94 |
+
return sympify(equation, locals=local_sympy_mappings)
|
95 |
+
raise TypeError(f"Error processing equation '{equation}'") from e
|
96 |
|
97 |
|
98 |
def assert_valid_sympy_symbol(var_name: str) -> None:
|