See the examples in the other sections for how to use specific interfaces. The interface classes all derive from the generic interface that is described in this section.
AUTHORS:
Bases: sage.interfaces.interface.Interface
Expect interface object.
x.__init__(...) initializes x; see help(type(x)) for signature
INPUT:
code – text to evaluate
etc. (ignored in the base class).
with the Sage notebook’s generic system interface.
interface-specific threshold then code will be communicated via a temporary file rather that the character-based interface. If False then the code will be communicated via the character interface.
unless it gets communicated via a temporary file. If True then code is sent line by line, but some lines individually might be sent via temporary file. Depending on the interface, this may transform grammatical code into ungrammatical input. If False, then the whole block of code is evaluated all at once.
method. An often useful example is reformat=False.
x.__init__(...) initializes x; see help(type(x)) for signature
x.__init__(...) initializes x; see help(type(x)) for signature
x.__init__(...) initializes x; see help(type(x)) for signature
x.__init__(...) initializes x; see help(type(x)) for signature
Return True if self is currently running.
x.__init__(...) initializes x; see help(type(x)) for signature
Return the PID of the underlying sub-process.
REMARK:
If the interface terminates unexpectedly, the original PID will still be used. But if it was terminated using quit(), a new sub-process with a new PID is automatically started.
EXAMPLE:
sage: pid = gap.pid()
sage: gap.eval('quit;')
''
sage: pid == gap.pid()
True
sage: gap.quit()
sage: pid == gap.pid()
False
EXAMPLES:
sage: a = maxima('y')
sage: maxima.quit()
sage: a._check_valid()
Traceback (most recent call last):
...
ValueError: The maxima session in which this object was defined is no longer running.
EXAMPLES:
sage: filename = tmp_filename()
sage: f = open(filename, 'w')
sage: f.write('x = 2\n')
sage: f.close()
sage: octave.read(filename) # optional - octave
sage: octave.get('x') #optional
' 2'
sage: import os
sage: os.unlink(filename)
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: sage.interfaces.interface.InterfaceElement
Expect element.
Bases: sage.interfaces.interface.InterfaceFunction
Expect function.
Bases: sage.interfaces.interface.InterfaceFunctionElement
Expect function element.
A context in which all communation between Sage and a subprocess interfaced via pexpect is printed to stdout.
x.__init__(...) initializes x; see help(type(x)) for signature
Bases: object
This is a “with” statement context manager. Garbage collection is disabled within its scope. Nested usage is properly handled.
EXAMPLES:
sage: import gc
sage: from sage.interfaces.expect import gc_disabled
sage: gc.isenabled()
True
sage: with gc_disabled():
... print gc.isenabled()
... with gc_disabled():
... print gc.isenabled()
... print gc.isenabled()
False
False
False
sage: gc.isenabled()
True
x.__init__(...) initializes x; see help(type(x)) for signature