More review changes.

* Favicon.ico is served.
* Test suit now passes.
* Help links work for for me.
* Other changes made to address inline comments.
* The printing of long lines is an extremely subtle issue and I will open an issue for it.
* zmqws.py is completely gone so the naked print is not an issue.
* ipython-notebook removed from scripts.
* Updated copyright and authors of files.
* Fixed missing docstrings in IPython.nbformat.
This commit is contained in:
Brian E. Granger 2011-08-17 13:21:19 -07:00
parent 63a148fad5
commit e176318797
17 changed files with 123 additions and 23 deletions

View File

@ -1,10 +1,21 @@
"""Tornado handlers for the notebook."""
"""Tornado handlers for the notebook.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from tornado import web
from tornado import websocket

View File

@ -1,10 +1,15 @@
"""A kernel manager for multiple kernels."""
"""A kernel manager for multiple kernels.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as part of this software.
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------

View File

@ -1,10 +1,15 @@
"""A tornado based IPython notebook server."""
"""A tornado based IPython notebook server.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as part of this software.
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
@ -194,9 +199,9 @@ class IPythonNotebookApp(BaseIPythonApplication):
argv = sys.argv[1:]
self.kernel_argv = list(argv) # copy
# kernel should inherit default config file from frontend
# Kernel should inherit default config file from frontend
self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
# scrub frontend-specific flags
# Scrub frontend-specific flags
for a in argv:
if a.startswith('-') and a.lstrip('-') in notebook_flags:
self.kernel_argv.remove(a)
@ -205,7 +210,6 @@ class IPythonNotebookApp(BaseIPythonApplication):
alias = a.lstrip('-').split('=')[0]
if alias in notebook_aliases:
self.kernel_argv.remove(a)
print self.kernel_argv
def init_configurables(self):
# Don't let Qt or ZMQ swallow KeyboardInterupts.
@ -241,18 +245,20 @@ class IPythonNotebookApp(BaseIPythonApplication):
self.log.critical('WARNING: the notebook server is listening on all IP addresses '
'but not using any encryption or authentication. This is highly '
'insecure and not recommended.')
for i in range(10):
# Try random ports centered around the default.
from random import randint
n = 50 # Max number of attempts, keep reasonably large.
for port in [self.port] + [self.port + randint(-2*n, 2*n) for i in range(n)]:
try:
port = self.port + i
self.http_server.listen(port, self.ip)
except socket.error, e:
if e.errno != errno.EADDRINUSE:
raise
self.log.info('The port %i is already in use, trying: %i' % (port, port+1))
self.log.info('The port %i is already in use, trying another random port.' % port)
else:
self.port = port
break
def start(self):
ip = self.ip if self.ip else '[all ip addresses on your system]'

View File

@ -1,8 +1,15 @@
"""A notebook manager that uses the local file system for storage.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING.txt, distributed as part of this software.
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
@ -46,7 +53,7 @@ class NotebookManager(LoggingConfigurable):
dict(notebook_id=notebook,name=name)
"""
names = os.listdir(self.notebook_dir)
names = [name.split(u'.')[0] \
names = [name.split(u'.')[0]
for name in names if name.endswith(self.filename_ext)]
data = []
for name in names:
@ -76,9 +83,7 @@ class NotebookManager(LoggingConfigurable):
if notebook_id not in self.mapping:
return False
path = self.get_path_by_name(self.mapping[notebook_id])
if not os.path.isfile(path):
return False
return True
return os.path.isfile(path)
def find_path(self, notebook_id):
"""Return a full path to a notebook given its notebook_id."""

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Cell

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// CodeCell

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Kernel

View File

@ -1,3 +1,10 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
var IPython = IPython || {};
IPython.namespace = function (ns_string) {

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// On document ready

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Notebook

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// On document ready

View File

@ -1,6 +1,12 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Cell
// NotebookList
//============================================================================
var IPython = (function (IPython) {

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Pager

View File

@ -1,6 +1,12 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Cell
// SaveWidget
//============================================================================
var IPython = (function (IPython) {

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// TextCell

View File

@ -1,3 +1,9 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// Utilities