| Home | Trees | Indices | Help |
|---|
|
|
A Worksheet.
A worksheet is embedded in a webpage that is served by the Sage
server. It is a linearly-ordered collections of numbered cells, where
a cell is a single input/output block.
The worksheet module is responsible for running calculations in a
worksheet, spawning Sage processes that do all of the actual work and
are controlled via pexpect, and reporting on results of calculations.
The state of the cells in a worksheet is stored on the filesystem (not
in the notebook pickle sobj).
AUTHOR:
-- William Stein
|
|||
| Worksheet | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
whitespace = re.compile(r'\s')
|
|||
non_whitespace = re.compile(r'\S')
|
|||
INTERRUPT_TRIES = 3
|
|||
INITIAL_NUM_CELLS = 1
|
|||
WARN_THRESHOLD = 100
|
|||
SC =
|
|||
SAGE_BEGIN =
|
|||
SAGE_END =
|
|||
SAGE_ERROR =
|
|||
ARCHIVED = 0
|
|||
ACTIVE = 1
|
|||
TRASH = 2
|
|||
multisession = True
|
|||
_a_sage =
|
|||
__internal_test1 =
|
|||
__internal_test2 =
|
|||
|
|||
Return one copy of a Sage compute process that has initialization
code run.
INPUT:
server -- if sessions will be run via ssh on a remote account then
this string specifies that account (passed on to the Sage
pexpect interface).
ulimit -- string; passed to the ulimit command before running
the subprocess
OUTPUT:
a pexpect interface to a local or remote copy of Sage
EXAMPLES:
sage: S = sage.server.notebook.worksheet.initialized_sage(None,None)
sage: S
Sage
|
Set the module-scope variable _a_sage to
an initialized sage server.
INPUT:
server, ulimit -- strings that are passed
to the Sage pexpect interface constructor
EXAMPLES:
The _a_sage variable is initially set to None:
sage: sage.server.notebook.worksheet._a_sage
We call init_sage_prestart and now _a_sage is a Sage instance:
sage: sage.server.notebook.worksheet.init_sage_prestart(None,None)
sage: sage.server.notebook.worksheet._a_sage
Sage
|
Return a Sage interface that has been initialized.
INPUT:
server, ulimit -- strings that are passed
to the Sage pexpect interface constructor
OUTPUT:
-- an interface to a running copy of Sage
If the global variable multisession is true, each call to
one_prestarted_sage returns a new Sage compute instance.
Otherwise it always returns the same instance.
EXAMPLES:
sage: sage.server.notebook.worksheet.one_prestarted_sage(None,None)
Sage
sage: sage.server.notebook.worksheet.multisession=False
sage: sage.server.notebook.worksheet.one_prestarted_sage(None,None) is sage.server.notebook.worksheet._a_sage
True
sage: sage.server.notebook.worksheet.multisession=True
|
Return the relative directory name of this worksheet
with given name and owner.
INPUT:
name -- string, which may have spaces and funny characters, which
are replaced by underscores.
owner -- string, with no spaces or funny characters
OUTPUT:
string
EXAMPLES:
sage: sage.server.notebook.worksheet.worksheet_filename('Example worksheet 3', 'sage10')
'sage10/Example_worksheet_3'
sage: sage.server.notebook.worksheet.worksheet_filename('Example#%&! work\sheet 3', 'sage10')
'sage10/Example_____work_sheet_3'
|
Given a string s that defines an input block of code,
if the first line begins in \samp{sage:} (or \samp{>>>}),
strip out all lines
that don't begin in either \samp{sage:} (or \samp{>>>}) or \samp{...}, and
remove all \samp{sage:} (or \samp{>>>}) and \samp{...} from the beginning
of the remaining lines.
TESTS:
sage: test1 = sage.server.notebook.worksheet.__internal_test1
sage: test1 == sage.server.notebook.worksheet.ignore_prompts_and_output(test1)
True
sage: test2 = sage.server.notebook.worksheet.__internal_test2
sage: sage.server.notebook.worksheet.ignore_prompts_and_output(test2)
'2 + 2\n'
|
Return everything after the first whitespace in the string s.
Returns the empty string if there is nothing after the
first whitespace.
INPUT:
s -- string
OUTPUT:
a string
|
INPUT:
s -- a string like 'in=5, out=7'
OUTPUT:
dict -- such as {'in':5, 'out':7}
|
The point of this function is to allow for searches like this:
\begin{verbatim}
"ws 7" foo bar Modular '"the" end'
\end{verbatim}
i.e., where search terms can be in quotes and the different quote
types can be mixed.
INPUT:
s -- a string
OUTPUT:
list -- a list of strings
|
|
|||
_a_sage
|
__internal_test1
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:29 2008 | http://epydoc.sourceforge.net |