Permalink
Browse files

Merge pull request #121 from jhpalmieri/remove-old-notebook

We should remove the old notebook from Sage.
  • Loading branch information...
2 parents 9ad3993 + 4ef09d8 commit 72b4a5826de5ad57d0d56900407b29f83b107d7b @kini kini committed Mar 22, 2013
Showing with 23 additions and 20 deletions.
  1. +12 −9 sagenb/misc/misc.py
  2. +5 −5 sagenb/misc/support.py
  3. +2 −2 sagenb/notebook/cell.py
  4. +4 −4 sagenb/simple/twist.py
View
@@ -41,25 +41,26 @@ def print_open_msg(address, port, secure=False, path=""):
EXAMPLES::
- sage: sage.server.misc.print_open_msg('localhost', 8080, True)
+ sage: from sagenb.misc.misc import print_open_msg
+ sage: print_open_msg('localhost', 8080, True)
****************************************************
* *
* Open your web browser to https://localhost:8080 *
* *
****************************************************
- sage: sage.server.misc.print_open_msg('sagemath.org', 8080, False)
+ sage: print_open_msg('sagemath.org', 8080, False)
******************************************************
* *
* Open your web browser to http://sagemath.org:8080 *
* *
******************************************************
- sage: sage.server.misc.print_open_msg('sagemath.org', 90, False)
+ sage: print_open_msg('sagemath.org', 90, False)
****************************************************
* *
* Open your web browser to http://sagemath.org:90 *
* *
****************************************************
- sage: sage.server.misc.print_open_msg('sagemath.org', 80, False)
+ sage: print_open_msg('sagemath.org', 80, False)
**************************************************
* *
* Open your web browser to http://sagemath.org *
@@ -87,12 +88,14 @@ def print_open_msg(address, port, secure=False, path=""):
def find_next_available_port(interface, start, max_tries=100, verbose=False):
"""
- Find the next available port, that is, a port for which a
- current connection attempt returns a 'Connection refused' error
- message. If no port is found, raise a RuntimError exception.
+ Find the next available port at a given interface, that is, a port for
+ which a current connection attempt returns a 'Connection refused'
+ error message. If no port is found, raise a RuntimeError exception.
INPUT:
+ - ``interface`` - address to check
+
- ``start`` - an int; the starting port number for the scan
- ``max_tries`` - an int (default: 100); how many ports to scan
@@ -106,8 +109,8 @@ def find_next_available_port(interface, start, max_tries=100, verbose=False):
EXAMPLES::
- sage: import sagenb
- sage: sagenb.misc.misc.find_next_available_port('127.0.0.1', 9000, verbose=False) # random output -- depends on network
+ sage: from sagenb.misc.misc import find_next_available_port
+ sage: find_next_available_port('127.0.0.1', 9000, verbose=False) # random output -- depends on network
9002
"""
alarm_count = 0
@@ -113,7 +113,7 @@ def help(obj):
sage: import numpy.linalg
sage: import os, sage.misc.misc ; current_dir = os.getcwd()
sage: os.chdir(sage.misc.misc.tmp_dir('server_doctest'))
- sage: sage.server.support.help(numpy.linalg.norm)
+ sage: sagenb.misc.support.help(numpy.linalg.norm)
<html><table notracebacks bgcolor="#386074" cellpadding=10 cellspacing=10><tr><td bgcolor="#f5f5f5"><font color="#37546d">
&nbsp;&nbsp;&nbsp;<a target='_new' href='cell://docs-....html'>Click to open help window</a>&nbsp;&nbsp;&nbsp;
<br></font></tr></td></table></html>
@@ -467,16 +467,16 @@ def syseval(system, cmd, dir=None):
EXAMPLES::
sage: from sage.misc.python import python
- sage: sage.server.support.syseval(python, '2+4/3')
+ sage: sagenb.misc.support.syseval(python, '2+4/3')
3
''
- sage: sage.server.support.syseval(python, 'import os; os.chdir(".")')
+ sage: sagenb.misc.support.syseval(python, 'import os; os.chdir(".")')
''
- sage: sage.server.support.syseval(python, 'import os; os.chdir(1,2,3)')
+ sage: sagenb.misc.support.syseval(python, 'import os; os.chdir(1,2,3)')
Traceback (most recent call last):
...
TypeError: chdir() takes exactly 1 argument (3 given)
- sage: sage.server.support.syseval(gap, "2+3")
+ sage: sagenb.misc.support.syseval(gap, "2+3")
'5'
"""
if dir:
@@ -1619,7 +1619,7 @@ def set_output_text(self, output, html, sage=None):
output = output.replace('\r', '')
# We do not truncate if "notruncate" or "Output truncated!" already
# appears in the output. This notruncate tag is used right now
- # in sage.server.support.help.
+ # in sagenb.notebook.interact, sage.misc.html, and sage.database.sql_db.
if ('notruncate' not in output and
'Output truncated!' not in output
and
@@ -2474,7 +2474,7 @@ def format_exception(s0, ncols):
s = s0.lstrip()
# Add a notracebacks option -- if it is in the string then
# tracebacks aren't shrunk. This is currently used by the
- # sage.server.support.help command.
+ # functions sagenb.misc.support.help and sage.server.support.help.
if TRACEBACK not in s or 'notracebacks' in s:
return s0
if ncols > 0:
@@ -24,11 +24,11 @@
Start the notebook server.::
- sage: from sage.server.misc import find_next_available_port
+ sage: from sagenb.misc.misc import find_next_available_port
sage: port = find_next_available_port(9000, verbose=False)
sage: from sagenb.notebook.notebook_object import test_notebook
sage: passwd = str(randint(1,1<<128))
- sage: nb = test_notebook(passwd, secure=False, address='localhost', port=port, verbose=True) #doctest: +ELLIPSIS
+ sage: nb = test_notebook(passwd, secure=False, address='localhost', port=port, verbose=True)
...
Notebook started.
@@ -160,7 +160,7 @@ def simple_jsonize(data):
EXAMPLES::
- sage: from sage.server.simple.twist import simple_jsonize
+ sage: from sagenb.simple.twist import simple_jsonize
sage: print simple_jsonize({'a': [1,2,3], 'b': "yep"})
{ "a": [1, 2, 3], "b": "yep" }
"""
@@ -195,7 +195,7 @@ def get_status(self):
TEST::
- sage: from sage.server.simple.twist import SessionObject
+ sage: from sagenb.simple.twist import SessionObject
sage: s = SessionObject(id=1, username=None, worksheet=None)
sage: s.get_status()
{'session': 1}

0 comments on commit 72b4a58

Please sign in to comment.