Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
2fe6870
1
Parent(s):
9dbc6d3
Always try to set `jl.seval`
Browse files- pysr/julia_import.py +8 -4
pysr/julia_import.py
CHANGED
@@ -58,14 +58,18 @@ elif os.environ["PYSR_AUTOLOAD_EXTENSIONS"] not in {"no", "yes", ""}:
|
|
58 |
|
59 |
from juliacall import Main as jl # type: ignore
|
60 |
|
|
|
61 |
# Finally, overwrite the seval function to use Meta.parseall
|
62 |
# instead of Meta.parse.
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
|
|
|
68 |
jl.seval = seval
|
|
|
|
|
69 |
|
70 |
jl.seval("using SymbolicRegression")
|
71 |
SymbolicRegression = jl.SymbolicRegression
|
|
|
58 |
|
59 |
from juliacall import Main as jl # type: ignore
|
60 |
|
61 |
+
|
62 |
# Finally, overwrite the seval function to use Meta.parseall
|
63 |
# instead of Meta.parse.
|
64 |
+
# TODO: Overwrite this once PythonCall.jl is updated:
|
65 |
+
def seval(s: str):
|
66 |
+
return jl.eval(jl.Meta.parseall(s))
|
67 |
+
|
68 |
|
69 |
+
try:
|
70 |
jl.seval = seval
|
71 |
+
except:
|
72 |
+
pass
|
73 |
|
74 |
jl.seval("using SymbolicRegression")
|
75 |
SymbolicRegression = jl.SymbolicRegression
|