Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
bandaid for giac pexpect unwanted timing display
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed May 16, 2020
1 parent 765c5cb commit 203f9eb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/sage/interfaces/giac.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,24 +580,30 @@ def cputime(self, t=None):
else:
return float(self('time() - %s'%float(t)))


def _eval_line(self, line, allow_use_file=True, wait_for_prompt=True, restart_if_needed=False):
"""
EXAMPLES::
sage: giac._eval_line('2+2')
'4'
sage: A=matrix([range(280)])
sage: GA=giac(A)
sage: A = matrix([range(280)])
sage: GA = giac(A)
TESTS::
sage: h='int(1/x*((-2*x^(1/3)+1)^(1/4))^3,x)'
sage: giac(h)
12*(...)
"""
with gc_disabled():
z = Expect._eval_line(self, line, allow_use_file=allow_use_file,
wait_for_prompt=wait_for_prompt)
if z.lower().find("error") != -1:
raise RuntimeError("An error occurred running a Giac command:\nINPUT:\n%s\nOUTPUT:\n%s"%(line, z))
return z

lines = (line for line in z.splitlines()
if not line.startswith('Evaluation time:'))
return "\n".join(lines)

def eval(self, code, strip=True, **kwds):
r"""
Expand Down

0 comments on commit 203f9eb

Please sign in to comment.