version 1.2, 2019/03/06 02:38:33 |
version 1.3, 2019/03/29 02:17:00 |
|
|
# $OpenXM: OpenXM/src/sage/asir.py,v 1.1 2018/09/08 05:35:35 takayama Exp $ |
# $OpenXM: OpenXM/src/sage/asir.py,v 1.2 2019/03/06 02:38:33 takayama Exp $ |
from __future__ import print_function |
from __future__ import print_function |
from __future__ import absolute_import |
from __future__ import absolute_import |
|
|
Line 16 class Asir(Expect): |
|
Line 16 class Asir(Expect): |
|
|
|
EXAMPLES:: |
EXAMPLES:: |
|
|
sage: asir.eval("F=fctr(x^10-1)") # optional - asir |
sage: asir.evall("F=fctr(x^10-1)") # optional - asir |
""" |
""" |
|
|
def __init__(self, maxread=None, script_subdirectory=None, logfile=None, |
def __init__(self, maxread=None, script_subdirectory=None, logfile=None, |
Line 99 class Asir(Expect): |
|
Line 99 class Asir(Expect): |
|
http://www.openxm.org |
http://www.openxm.org |
The command openxm must be in the search path. |
The command openxm must be in the search path. |
""" |
""" |
|
def evall(self,cmd): |
|
""" |
|
evalutes the argument immediately. The argument of eval is buffered |
|
and ; should be added. |
|
EXAMPLES:: |
|
sage: asir.eval('1+2;'); asir.evall('3+3') |
|
""" |
|
return self.eval(cmd+';;') |
def _eval_line(self, line, reformat=True, allow_use_file=False, |
def _eval_line(self, line, reformat=True, allow_use_file=False, |
wait_for_prompt=True, restart_if_needed=False): |
wait_for_prompt=True, restart_if_needed=False): |
""" |
""" |
Line 229 class Asir(Expect): |
|
Line 236 class Asir(Expect): |
|
sage: asir.get('X') # optional - asir |
sage: asir.get('X') # optional - asir |
' 2' |
' 2' |
""" |
""" |
cmd = '%s=%s;'%(var,value) |
cmd = '%s=%s'%(var,value) |
out = self.eval(cmd) |
out = self.evall(cmd) |
if out.find("error") != -1 or out.find("Error") != -1: |
if out.find("error") != -1 or out.find("Error") != -1: |
raise TypeError("Error executing code in Asir\nCODE:\n\t%s\nAsir ERROR:\n\t%s"%(cmd, out)) |
raise TypeError("Error executing code in Asir\nCODE:\n\t%s\nAsir ERROR:\n\t%s"%(cmd, out)) |
|
|
Line 244 class Asir(Expect): |
|
Line 251 class Asir(Expect): |
|
sage: asir.get('X') # optional - asir |
sage: asir.get('X') # optional - asir |
' 2' |
' 2' |
""" |
""" |
s = self.eval('%s;'%var) |
s = self.evall('%s;'%var) |
i = s.find('=') |
i = s.find('=') |
return s[i+1:] |
return s[i+1:] |
|
|