File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ from mathics .core .parser import parse , SingleLineFeeder
2+ from mathics .core .definitions import Definitions
3+ from mathics .core .evaluation import Evaluation
4+ from mathics import settings
5+
6+
7+ class MathicsSession :
8+ def __init__ (self , add_builtin = True , catch_interrupt = False , form = "InputForm" ):
9+ self .definitions = Definitions (add_builtin )
10+ self .evaluation = Evaluation (definitions = self .definitions , catch_interrupt = catch_interrupt )
11+ self .form = form
12+
13+ def evaluate (self , str_expression , timeout = None , form = None ):
14+ expr = parse (self .definitions , SingleLineFeeder (str_expression ))
15+ if form is None :
16+ form = self .form
17+ return expr .evaluate (self .evaluation ).format (ms .evaluation , form )
18+
19+
You can’t perform that action at this time.
0 commit comments