[Python-modules-commits] [jupyter-notebook] 01/19: Import jupyter-notebook_5.1.0.orig.tar.gz

Gordon Ball chronitis-guest at moszumanska.debian.org
Sun Sep 17 21:08:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

chronitis-guest pushed a commit to branch master
in repository jupyter-notebook.

commit 011fc69ecbd29b048567dcf974167c5a927e3598
Author: Gordon Ball <gordon at chronitis.net>
Date:   Sun Sep 17 21:27:49 2017 +0200

    Import jupyter-notebook_5.1.0.orig.tar.gz
---
 .gitignore                                         |    3 +
 .travis.yml                                        |   15 +-
 MANIFEST.in                                        |    2 +-
 bower.json                                         |    9 +-
 docs/doc-requirements.txt                          |    3 +-
 docs/source/_static/images/cell-tags-toolbar.png   |  Bin 103041 -> 89424 bytes
 docs/source/changelog.rst                          |   31 +-
 docs/source/conf.py                                |    3 +
 .../examples/Notebook/Importing Notebooks.ipynb    |    5 +-
 .../source/examples/Notebook/Notebook Basics.ipynb |    2 +-
 .../Notebook/What is the Jupyter Notebook.ipynb    |    3 +-
 .../Notebook/Working With Markdown Cells.ipynb     |   14 +-
 docs/source/frontend_config.rst                    |    2 +-
 docs/source/notebook.rst                           |   33 +-
 docs/source/public_server.rst                      |    2 +-
 docs/source/security.rst                           |    5 +-
 notebook/_sysinfo.py                               |   14 +-
 notebook/_version.py                               |    2 +-
 notebook/allow76.py                                |  311 -
 notebook/base/handlers.py                          |   47 +-
 notebook/base/zmqhandlers.py                       |   11 +-
 notebook/files/handlers.py                         |   13 +-
 notebook/i18n/README.md                            |  122 +
 notebook/i18n/babel_nbjs.cfg                       |   11 +
 notebook/i18n/babel_nbui.cfg                       |    4 +
 notebook/i18n/babel_notebook.cfg                   |    2 +
 notebook/i18n/nbjs.json                            |   12 +
 notebook/i18n/nbjs.pot                             | 1927 +++++
 notebook/i18n/nbui.pot                             |  731 ++
 notebook/i18n/notebook.pot                         |  480 +
 notebook/jstest.py                                 |    2 -
 notebook/nbconvert/handlers.py                     |    4 +-
 notebook/nbextensions.py                           |  132 +-
 notebook/notebookapp.py                            |  383 +-
 notebook/services/contents/filemanager.py          |   41 +-
 notebook/services/contents/handlers.py             |   27 +-
 notebook/services/contents/manager.py              |   10 +-
 .../services/contents/tests/test_contents_api.py   |    4 +-
 notebook/services/contents/tests/test_manager.py   |   15 +-
 notebook/services/kernels/handlers.py              |   19 +-
 notebook/services/kernels/kernelmanager.py         |  107 +-
 notebook/services/security/handlers.py             |    6 +-
 notebook/services/shutdown.py                      |   15 +
 notebook/static/auth/js/loginmain.js               |    2 +-
 notebook/static/auth/js/logoutmain.js              |    2 +-
 notebook/static/base/images/favicon-busy-1.ico     |  Bin 0 -> 1150 bytes
 notebook/static/base/images/favicon-busy-2.ico     |  Bin 0 -> 1150 bytes
 notebook/static/base/images/favicon-busy-3.ico     |  Bin 0 -> 1150 bytes
 notebook/static/base/images/favicon-busy.ico       |  Bin 32038 -> 0 bytes
 notebook/static/base/images/favicon-file.ico       |  Bin 0 -> 1150 bytes
 notebook/static/base/images/favicon-notebook.ico   |  Bin 0 -> 1150 bytes
 notebook/static/base/images/favicon-terminal.ico   |  Bin 0 -> 1150 bytes
 notebook/static/base/js/dialog.js                  |   72 +-
 notebook/static/base/js/i18n.js                    |   54 +
 notebook/static/base/js/i18nload.js                |   26 +
 notebook/static/base/js/namespace.js               |    2 +-
 notebook/static/base/js/page.js                    |   18 +-
 notebook/static/base/js/promises.js                |   26 +
 notebook/static/base/js/utils.js                   |   86 +-
 notebook/static/base/less/page.less                |   17 +-
 notebook/static/custom/custom.js                   |   24 +-
 notebook/static/edit/js/editor.js                  |   80 +-
 notebook/static/edit/js/main.js                    |    2 +-
 notebook/static/edit/js/menubar.js                 |    2 +
 notebook/static/edit/js/savewidget.js              |    5 +
 notebook/static/edit/less/edit.less                |    4 +
 notebook/static/favicon.ico                        |    1 +
 notebook/static/notebook/js/about.js               |   26 +-
 notebook/static/notebook/js/actions.js             |  266 +-
 notebook/static/notebook/js/cell.js                |   13 +-
 notebook/static/notebook/js/celltoolbar.js         |    7 +-
 .../notebook/js/celltoolbarpresets/attachments.js  |    9 +-
 .../notebook/js/celltoolbarpresets/default.js      |    9 +-
 .../notebook/js/celltoolbarpresets/example.js      |    7 -
 .../notebook/js/celltoolbarpresets/rawcell.js      |   15 +-
 .../notebook/js/celltoolbarpresets/slideshow.js    |   18 +-
 .../static/notebook/js/celltoolbarpresets/tags.js  |   13 +-
 notebook/static/notebook/js/clipboard.js           |   22 +-
 notebook/static/notebook/js/codecell.js            |   29 +-
 notebook/static/notebook/js/commandpalette.js      |   28 +-
 notebook/static/notebook/js/completer.js           |   11 +-
 notebook/static/notebook/js/kernelselector.js      |   23 +-
 notebook/static/notebook/js/main.js                |    6 +-
 notebook/static/notebook/js/maintoolbar.js         |   18 +-
 notebook/static/notebook/js/mathjaxutils.js        |   19 +-
 notebook/static/notebook/js/menubar.js             |   15 +-
 notebook/static/notebook/js/notebook.js            |  207 +-
 notebook/static/notebook/js/notificationarea.js    |  154 +-
 notebook/static/notebook/js/outputarea.js          |   92 +-
 notebook/static/notebook/js/pager.js               |   11 +-
 notebook/static/notebook/js/promises.js            |   22 +
 notebook/static/notebook/js/quickhelp.js           |  136 +-
 notebook/static/notebook/js/savewidget.js          |   31 +-
 notebook/static/notebook/js/searchandreplace.js    |   38 +-
 notebook/static/notebook/js/shortcuteditor.js      |    2 +-
 notebook/static/notebook/js/textcell.js            |   16 +-
 notebook/static/notebook/js/toolbar.js             |   41 +-
 notebook/static/notebook/js/tooltip.js             |   17 +-
 notebook/static/notebook/js/tour.js                |   62 +-
 notebook/static/notebook/less/kernelselector.less  |    2 -
 notebook/static/notebook/less/renderedhtml.less    |   34 +-
 notebook/static/notebook/less/savewidget.less      |   22 +-
 notebook/static/notebook/less/tagbar.less          |    1 +
 notebook/static/notebook/less/toolbar.less         |    4 +
 notebook/static/robots.txt                         |    2 +
 notebook/static/services/contents.js               |   10 +
 notebook/static/services/kernels/comm.js           |   16 +-
 notebook/static/services/kernels/kernel.js         |    2 +-
 notebook/static/terminal/js/main.js                |    4 +-
 notebook/static/tree/js/kernellist.js              |    7 +-
 notebook/static/tree/js/main.js                    |    4 +-
 notebook/static/tree/js/newnotebook.js             |   13 +-
 notebook/static/tree/js/notebooklist.js            |  350 +-
 notebook/static/tree/js/sessionlist.js             |   19 +-
 notebook/static/tree/js/terminallist.js            |    7 +-
 notebook/templates/404.html                        |    2 +-
 notebook/templates/edit.html                       |   36 +-
 notebook/templates/error.html                      |    2 +-
 notebook/templates/login.html                      |   10 +-
 notebook/templates/logout.html                     |   11 +-
 notebook/templates/notebook.html                   |  229 +-
 notebook/templates/page.html                       |   22 +-
 notebook/templates/terminal.html                   |   11 +-
 notebook/templates/tree.html                       |   79 +-
 notebook/tests/services/serialize.js               |    4 -
 notebook/tests/test_files.py                       |    2 +-
 notebook/tests/test_nbextensions.py                |   28 +-
 notebook/tests/test_notebookapp.py                 |   36 +
 notebook/transutils.py                             |   14 +
 notebook/utils.py                                  |   45 +-
 notebook/view/handlers.py                          |    2 +-
 scripts/less-watch                                 |   42 -
 setupbase.py                                       |   16 +-
 tools/build-main.js                                |    5 +-
 tools/patches/codemirror.js                        | 9124 --------------------
 135 files changed, 5800 insertions(+), 10807 deletions(-)

diff --git a/.gitignore b/.gitignore
index f58f8f8..2c2eb30 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,6 @@ src
 Read the Docs
 config.rst
 
+/.project
+/.pydevproject
+
diff --git a/.travis.yml b/.travis.yml
index fa10c6c..79ebba5 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,7 +8,7 @@ python:
     - 3.5.1  # Set to 3.5.1 since travis has not yet included as default for 3.5
     - 2.7
 
-sudo: false
+sudo: required
 
 env:
   global:
@@ -19,6 +19,7 @@ env:
     - GROUP=js/base
     - GROUP=js/services
     - GROUP=js/tree
+    - GROUP=docs
 
 before_install:
     - pip install --upgrade pip
@@ -30,17 +31,24 @@ before_install:
     - npm upgrade -g npm
     - npm install
     - |
-      if [[ $GROUP == js* ]]; then 
+      if [[ $GROUP == js* ]]; then
         npm install -g casperjs at 1.1.3 phantomjs-prebuilt at 2.1.7
       fi
     - git clone --quiet --depth 1 https://github.com/minrk/travis-wheels travis-wheels
+    - |
+      if [[ $GROUP == docs ]]; then
+        pip install -r docs/doc-requirements.txt
+      fi
 
 install:
     - pip install -f travis-wheels/wheelhouse file://$PWD#egg=notebook[test]
+    - wget https://github.com/jgm/pandoc/releases/download/1.19.1/pandoc-1.19.1-1-amd64.deb && sudo dpkg -i pandoc-1.19.1-1-amd64.deb
+
 
 script:
     - 'if [[ $GROUP == js* ]]; then travis_retry python -m notebook.jstest ${GROUP:3}; fi'
     - 'if [[ $GROUP == python ]]; then nosetests -v --with-coverage --cover-package=notebook notebook; fi'
+    - 'if [[ $GROUP == docs ]]; then make -C docs/ html; fi'
 
 matrix:
     include:
@@ -48,6 +56,9 @@ matrix:
           env: GROUP=python
         - python: 3.4
           env: GROUP=python
+    exclude:
+        - python: 2.7
+          env: GROUP=docs
 
 after_success:
     - codecov
diff --git a/MANIFEST.in b/MANIFEST.in
index 6e377a7..63f216e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,5 @@
 include COPYING.md
-include CONTRIBUTING.md
+include CONTRIBUTING.rst
 include README.md
 include package.json
 include bower.json
diff --git a/bower.json b/bower.json
index e58ec92..52ca303 100644
--- a/bower.json
+++ b/bower.json
@@ -5,10 +5,11 @@
     "backbone": "components/backbone#~1.2",
     "bootstrap": "components/bootstrap#~3.3",
     "bootstrap-tour": "0.9.0",
-    "codemirror": "components/codemirror#~5.22.2",
+    "codemirror": "components/codemirror#~5.27",
     "es6-promise": "~1.0",
-    "font-awesome": "components/font-awesome#~4.2.0",
+    "font-awesome": "components/font-awesome#~4.7.0",
     "google-caja": "5669",
+    "jed": "~1.1.1",
     "jquery": "components/jquery#~2.0",
     "jquery-typeahead": "~2.0.0",
     "jquery-ui": "components/jqueryui#~1.10",
@@ -19,8 +20,10 @@
     "preact-compat": "https://unpkg.com/preact-compat@^3.14.3/dist/preact-compat.min.js",
     "proptypes": "https://unpkg.com/proptypes@^0.14.4/index.js",
     "requirejs": "~2.1",
+    "requirejs-text": "~2.0.15",
+    "requirejs-plugins": "~1.0.3",
     "text-encoding": "~0.1",
     "underscore": "components/underscore#~1.8.3",
-    "xterm.js": "sourcelair/xterm.js#~2.3.2"
+    "xterm.js": "sourcelair/xterm.js#~2.8.1"
   }
 }
diff --git a/docs/doc-requirements.txt b/docs/doc-requirements.txt
index 52a2ed2..fbdd21c 100644
--- a/docs/doc-requirements.txt
+++ b/docs/doc-requirements.txt
@@ -1,2 +1,3 @@
 sphinx>=1.3.6
-sphinx-rtd-theme
\ No newline at end of file
+sphinx-rtd-theme
+nbsphinx==0.2.14
diff --git a/docs/source/_static/images/cell-tags-toolbar.png b/docs/source/_static/images/cell-tags-toolbar.png
index 9fcf992..cab448f 100644
Binary files a/docs/source/_static/images/cell-tags-toolbar.png and b/docs/source/_static/images/cell-tags-toolbar.png differ
diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst
index 3ebb18e..ebbda56 100644
--- a/docs/source/changelog.rst
+++ b/docs/source/changelog.rst
@@ -21,10 +21,37 @@ We strongly recommend that you upgrade to version 9+ of pip before upgrading ``n
     ``pip --version``.
 
 
+.. _release-5.1.0:
+
+5.1.0
+-----
+
+- Preliminary i18n implementation (:ghpull:`2140`).
+- Expose URL with auth token in notebook UI (:ghpull:`2666`).
+- Fix search background style (:ghpull:`2387`).
+- List running notebooks without requiring ``--allow-root`` (:ghpull:`2421`).
+- Allow session of type other than notebook (:ghpull:`2559`).
+- Fix search background style (:ghpull:`2387`).
+- Fix some Markdown styling issues (:ghpull:`2571`), (:ghpull:`2691`) and (:ghpull:`2534`).
+- Remove keymaps that conflict with non-English keyboards (:ghpull:`2535`).
+- Add session-specific favicons (notebook, terminal, file) (:ghpull:`2452`).
+- Add /api/shutdown handler (:ghpull:`2507`).
+- Include metadata when copying a cell (:ghpull:`2349`).
+- Stop notebook server from command line (:ghpull:`2388`).
+- Improve "View" and "Edit" file handling in dashboard (:ghpull:`2449`) and (:ghpull:`2402`).
+- Provide a promise to replace use of the ``app_initialized.NotebookApp`` event (:ghpull:`2710`).
+- Fix disabled collapse/expand output button (:ghpull:`2681`).
+- Cull idle kernels using ``--MappingKernelManager.cull_idle_timeout`` (:ghpull:`2215`).
+- Allow read-only notebooks to be trusted (:ghpull:`2718`).
+
+See the 5.1 milestone on GitHub for a complete list of
+`issues <https://github.com/jupyter/notebook/issues?utf8=%E2%9C%93&q=is%3Aissue%20milestone%3A5.1>`__
+and `pull requests <https://github.com/jupyter/notebook/pulls?utf8=%E2%9C%93&q=is%3Apr%20milestone%3A5.1>`__ involved in this release.
+
 .. _release-5.0.0:
 
-Notebook version 5.0
---------------------
+5.0.0
+-----
 
 This is the first major release of the Jupyter Notebook since version 4.0 was
 created by the "Big Split" of IPython and Jupyter.
diff --git a/docs/source/conf.py b/docs/source/conf.py
index c82a234..0362a41 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -345,3 +345,6 @@ intersphinx_mapping = {
 
 spelling_lang='en_US'
 spelling_word_list_filename='spelling_wordlist.txt'
+
+# import before any doc is built, so _ is guaranteed to be injected
+import notebook.transutils
diff --git a/docs/source/examples/Notebook/Importing Notebooks.ipynb b/docs/source/examples/Notebook/Importing Notebooks.ipynb
index a7cdbcb..d6db539 100644
--- a/docs/source/examples/Notebook/Importing Notebooks.ipynb	
+++ b/docs/source/examples/Notebook/Importing Notebooks.ipynb	
@@ -344,7 +344,7 @@
    "cell_type": "markdown",
    "metadata": {},
    "source": [
-    "So my notebook has a heading cell and some code cells,\n",
+    "So my notebook has some code cells,\n",
     "one of which contains some IPython syntax.\n",
     "\n",
     "Let's see what happens when we import it"
@@ -511,6 +511,9 @@
  ],
  "metadata": {
   "gist_id": "6011986",
+  "nbsphinx": {
+   "execute": "never"
+  },
   "kernelspec": {
    "display_name": "Python 3",
    "language": "python",
diff --git a/docs/source/examples/Notebook/Notebook Basics.ipynb b/docs/source/examples/Notebook/Notebook Basics.ipynb
index 94df61b..aa8419b 100644
--- a/docs/source/examples/Notebook/Notebook Basics.ipynb	
+++ b/docs/source/examples/Notebook/Notebook Basics.ipynb	
@@ -194,7 +194,7 @@
    "source": [
     "The second idea of mouse based navigation is that **cell actions usually apply to the currently selected cell**. Thus if you want to run the code in a cell, you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-step-forward icon-step-forward\"></i></button> button in the toolbar or the \"Cell:Run\" menu item. Similarly, to copy a cell you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-copy icon-copy\"></i></b [...]
     "\n",
-    "Markdown and heading cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the <button class='btn btn-default btn-xs'><i class=\"fa fa-step-forward icon-step-forward\"></i></button> button in the toolbar or the \ [...]
+    "Markdown cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the <button class='btn btn-default btn-xs'><i class=\"fa fa-step-forward icon-step-forward\"></i></button> button in the toolbar or the \"Cell:Run\"  [...]
    ]
   },
   {
diff --git a/docs/source/examples/Notebook/What is the Jupyter Notebook.ipynb b/docs/source/examples/Notebook/What is the Jupyter Notebook.ipynb
index a5edb80..af9b187 100644
--- a/docs/source/examples/Notebook/What is the Jupyter Notebook.ipynb	
+++ b/docs/source/examples/Notebook/What is the Jupyter Notebook.ipynb	
@@ -79,7 +79,6 @@
     "* See the results of computations with **rich media representations**, such as HTML, LaTeX, PNG, SVG, PDF, etc.\n",
     "* Create and use **interactive JavaScript widgets**, which bind interactive user interface controls and visualizations to reactive kernel side computations.\n",
     "* Author **narrative text** using the [Markdown](https://daringfireball.net/projects/markdown/) markup language.\n",
-    "* Build **hierarchical documents** that are organized into sections with different levels of headings.\n",
     "* Include mathematical equations using **LaTeX syntax in Markdown**, which are rendered in-browser by [MathJax](http://www.mathjax.org/)."
    ]
   },
@@ -111,7 +110,7 @@
     "\n",
     "The default kernel runs Python code. The notebook provides a simple way for users to pick which of these kernels is used for a given notebook. \n",
     "\n",
-    "Each of these kernels communicate with the notebook web application and web browser using a JSON over ZeroMQ/WebSockets message protocol that is described [here](http://ipython.org/ipython-doc/dev/development/messaging.html). Most users don't need to know about these details, but it helps to understand that \"kernels run code.\""
+    "Each of these kernels communicate with the notebook web application and web browser using a JSON over ZeroMQ/WebSockets message protocol that is described [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#messaging). Most users don't need to know about these details, but it helps to understand that \"kernels run code.\""
    ]
   },
   {
diff --git a/docs/source/examples/Notebook/Working With Markdown Cells.ipynb b/docs/source/examples/Notebook/Working With Markdown Cells.ipynb
index 1e03b83..b7ccc62 100644
--- a/docs/source/examples/Notebook/Working With Markdown Cells.ipynb	
+++ b/docs/source/examples/Notebook/Working With Markdown Cells.ipynb	
@@ -189,17 +189,13 @@
    "source": [
     "The Notebook webapp supports Github flavored markdown meaning that you can use triple backticks for code blocks:\n",
     "\n",
-    "    <pre>\n",
     "    ```python\n",
     "    print \"Hello World\"\n",
     "    ```\n",
-    "    </pre>\n",
     "\n",
-    "    <pre>\n",
     "    ```javascript\n",
     "    console.log(\"Hello World\")\n",
     "    ```\n",
-    "    </pre>\n",
     "\n",
     "Gives:\n",
     "\n",
@@ -213,16 +209,10 @@
     "\n",
     "And a table like this: \n",
     "\n",
-    "    <pre>\n",
-    "    ```\n",
-    "\n",
     "    | This | is   |\n",
     "    |------|------|\n",
     "    |   a  | table| \n",
     "\n",
-    "    ```\n",
-    "    </pre>\n",
-    "\n",
     "A nice HTML Table:\n",
     "\n",
     "| This | is   |\n",
@@ -278,7 +268,7 @@
     "\n",
     "    <img src=\"../images/python_logo.svg\" />\n",
     "\n",
-    "<img src=\"images/python_logo.svg\" />\n",
+    "<img src=\"../images/python_logo.svg\" />\n",
     "\n",
     "and a video with the HTML5 video tag:\n",
     "\n",
@@ -328,7 +318,7 @@
    "name": "python",
    "nbconvert_exporter": "python",
    "pygments_lexer": "ipython3",
-   "version": "3.5.2"
+   "version": "3.6.0"
   }
  },
  "nbformat": 4,
diff --git a/docs/source/frontend_config.rst b/docs/source/frontend_config.rst
index 6c4280a..be3699f 100644
--- a/docs/source/frontend_config.rst
+++ b/docs/source/frontend_config.rst
@@ -61,7 +61,7 @@ four spaces. Enter the following code snippet in your JavaScript console::
     var config = cell.config;
     var patch = {
           CodeCell:{
-            cm_config:{indentUnit: null} # only change here.
+            cm_config:{indentUnit: null} // only change here.
           }
         }
     config.update(patch)
diff --git a/docs/source/notebook.rst b/docs/source/notebook.rst
index f507210..c1ad640 100644
--- a/docs/source/notebook.rst
+++ b/docs/source/notebook.rst
@@ -208,15 +208,14 @@ operations within the notebook, by clicking on an icon.
 Structure of a notebook document
 --------------------------------
 
-The notebook consists of a sequence of cells.  A cell is a multiline
-text input field, and its contents can be executed by using
-:kbd:`Shift-Enter`, or by clicking either the "Play" button the toolbar, or
-`Cell | Run` in the menu bar.  The execution behavior of a cell is determined
-the cell's type.  There are four types of cells: **code cells**, **markdown
-cells**, **raw cells** and **heading cells**.  Every cell starts off
-being a **code cell**, but its type can be changed by using a drop-down on the
-toolbar (which will be "Code", initially), or via :ref:`keyboard shortcuts
-<keyboard-shortcuts>`.
+The notebook consists of a sequence of cells.  A cell is a multiline text input
+field, and its contents can be executed by using :kbd:`Shift-Enter`, or by
+clicking either the "Play" button the toolbar, or `Cell | Run` in the menu bar.
+The execution behavior of a cell is determined by the cell's type.  There are three
+types of cells: **code cells**, **markdown cells**, and **raw cells**.  Every
+cell starts off being a **code cell**, but its type can be changed by using a
+drop-down on the toolbar (which will be "Code", initially), or via
+:ref:`keyboard shortcuts <keyboard-shortcuts>`.
 
 For more information on the different things you can do in a notebook,
 see the `collection of examples
@@ -250,6 +249,11 @@ called *Markdown cells*. The Markdown language provides a simple way to
 perform this text markup, that is, to specify which parts of the text should
 be emphasized (italics), bold, form lists, etc.
 
+If you want to provide structure for your document, you can use markdown
+headings. Markdown headings consist of 1 to 6 hash # signs ``#`` followed by a
+space and the title of your section. The markdown heading will be converted
+to a clickable link for a section of the notebook. It is also used as a hint
+when exporting to other document formats, like PDF.
 
 When a Markdown cell is executed, the Markdown code is converted into
 the corresponding formatted rich text. Markdown allows arbitrary HTML code for
@@ -286,17 +290,6 @@ destination format unmodified. For example, this allows you to type full LaTeX
 into a raw cell, which will only be rendered by LaTeX after conversion by
 nbconvert.
 
-Heading cells
-~~~~~~~~~~~~~
-
-If you want to provide structure for your document, you can use markdown
-headings. Markdown headings consist of 1 to 6 hash # signs ``#`` followed by a
-space and the title of your section. The markdown heading will be converted
-to a clickable link for a section of the notebook. It is also used as a hint
-when exporting to other document formats, like PDF.
-We recommend using only one markdown header in a cell and limit the cell's
-content to the header text. For flexibility of text format conversion, we
-suggest placing additional text in the next notebook cell.
 
 Basic workflow
 --------------
diff --git a/docs/source/public_server.rst b/docs/source/public_server.rst
index efe5a86..fd079b5 100644
--- a/docs/source/public_server.rst
+++ b/docs/source/public_server.rst
@@ -289,7 +289,7 @@ with the following configuration setting in
 
     c.NotebookApp.tornado_settings = {
         'headers': {
-            'Content-Security-Policy': "frame-ancestors 'https://mywebsite.example.com' 'self' "
+            'Content-Security-Policy': "frame-ancestors https://mywebsite.example.com 'self' "
         }
     }
 
diff --git a/docs/source/security.rst b/docs/source/security.rst
index aaa8dfc..f90f9d6 100644
--- a/docs/source/security.rst
+++ b/docs/source/security.rst
@@ -12,7 +12,7 @@ For this reason, notebook 4.3 introduces token-based authentication that is **on
 
     If you enable a password for your notebook server,
     token authentication is not enabled by default,
-    and the behavior of the notebook server is unchanged from from versions earlier than 4.3.
+    and the behavior of the notebook server is unchanged from versions earlier than 4.3.
 
 When token authentication is enabled, the notebook uses a token to authenticate requests.
 This token can be provided to login to the notebook server in three ways:
@@ -31,7 +31,8 @@ When you start a notebook server with token authentication enabled (default),
 a token is generated to use for authentication.
 This token is logged to the terminal, so that you can copy/paste the URL into your browser::
 
-    [I 11:59:16.597 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=c8de56fa4deed24899803e93c227592aef6538f93025fe01
+    [I 11:59:16.597 NotebookApp] The Jupyter Notebook is running at:
+    http://localhost:8888/?token=c8de56fa4deed24899803e93c227592aef6538f93025fe01
 
 
 If the notebook server is going to open your browser automatically
diff --git a/notebook/_sysinfo.py b/notebook/_sysinfo.py
index ea237bb..4e6a366 100644
--- a/notebook/_sysinfo.py
+++ b/notebook/_sysinfo.py
@@ -46,11 +46,15 @@ def pkg_commit_hash(pkg_path):
     while cur_path != par_path:
         cur_path = par_path
         if p.exists(p.join(cur_path, '.git')):
-            proc = subprocess.Popen('git rev-parse --short HEAD',
-                                stdout=subprocess.PIPE,
-                                stderr=subprocess.PIPE,
-                                cwd=pkg_path, shell=True)
-            repo_commit, _ = proc.communicate()
+            try:
+                proc = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'],
+                                    stdout=subprocess.PIPE,
+                                    stderr=subprocess.PIPE,
+                                    cwd=pkg_path)
+                repo_commit, _ = proc.communicate()
+            except OSError:
+                repo_commit = None
+
             if repo_commit:
                 return 'repository', repo_commit.strip().decode('ascii')
             else:
diff --git a/notebook/_version.py b/notebook/_version.py
index 647ec90..49ee02d 100644
--- a/notebook/_version.py
+++ b/notebook/_version.py
@@ -9,5 +9,5 @@ store the current version info of the notebook.
 
 # Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**. 
 
-version_info = (5, 0, 0)
+version_info = (5, 1, 0)
 __version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])
diff --git a/notebook/allow76.py b/notebook/allow76.py
deleted file mode 100644
index 67e87e8..0000000
--- a/notebook/allow76.py
+++ /dev/null
@@ -1,311 +0,0 @@
-"""WebsocketProtocol76 from tornado 3.2.2 for tornado >= 4.0
-
-The contents of this file are Copyright (c) Tornado
-Used under the Apache 2.0 license
-"""
-
-
-from __future__ import absolute_import, division, print_function, with_statement
-# Author: Jacob Kristhammar, 2010
-
-import functools
-import hashlib
-import struct
-import time
-import tornado.escape
-import tornado.web
-
-from tornado.log import gen_log, app_log
-from tornado.util import bytes_type, unicode_type
-
-from tornado.websocket import WebSocketHandler, WebSocketProtocol13
-
-class AllowDraftWebSocketHandler(WebSocketHandler):
-    """Restore Draft76 support for tornado 4
-    
-    Remove when we can run tests without phantomjs + qt4
-    """
-    
-    # get is unmodified except between the BEGIN/END PATCH lines
-    @tornado.web.asynchronous
-    def get(self, *args, **kwargs):
-        self.open_args = args
-        self.open_kwargs = kwargs
-
-        # Upgrade header should be present and should be equal to WebSocket
-        if self.request.headers.get("Upgrade", "").lower() != 'websocket':
-            self.set_status(400)
-            self.finish("Can \"Upgrade\" only to \"WebSocket\".")
-            return
-
-        # Connection header should be upgrade. Some proxy servers/load balancers
-        # might mess with it.
-        headers = self.request.headers
-        connection = map(lambda s: s.strip().lower(), headers.get("Connection", "").split(","))
-        if 'upgrade' not in connection:
-            self.set_status(400)
-            self.finish("\"Connection\" must be \"Upgrade\".")
-            return
-
-        # Handle WebSocket Origin naming convention differences
-        # The difference between version 8 and 13 is that in 8 the
-        # client sends a "Sec-Websocket-Origin" header and in 13 it's
-        # simply "Origin".
-        if "Origin" in self.request.headers:
-            origin = self.request.headers.get("Origin")
-        else:
-            origin = self.request.headers.get("Sec-Websocket-Origin", None)
-
-
-        # If there was an origin header, check to make sure it matches
-        # according to check_origin. When the origin is None, we assume it
-        # did not come from a browser and that it can be passed on.
-        if origin is not None and not self.check_origin(origin):
-            self.set_status(403)
-            self.finish("Cross origin websockets not allowed")
-            return
-
-        self.stream = self.request.connection.detach()
-        self.stream.set_close_callback(self.on_connection_close)
-
-        if self.request.headers.get("Sec-WebSocket-Version") in ("7", "8", "13"):
-            self.ws_connection = WebSocketProtocol13(self)
-            self.ws_connection.accept_connection()
-        #--------------- BEGIN PATCH ----------------
-        elif (self.allow_draft76() and
-              "Sec-WebSocket-Version" not in self.request.headers):
-            self.ws_connection = WebSocketProtocol76(self)
-            self.ws_connection.accept_connection()
-        #--------------- END PATCH ----------------
-        else:
-            if not self.stream.closed():
-                self.stream.write(tornado.escape.utf8(
-                    "HTTP/1.1 426 Upgrade Required\r\n"
-                    "Sec-WebSocket-Version: 8\r\n\r\n"))
-                self.stream.close()
-    
-    # 3.2 methods removed in 4.0:
-    def allow_draft76(self):
-        """Using this class allows draft76 connections by default"""
-        return True
-    
-    def get_websocket_scheme(self):
-        """Return the url scheme used for this request, either "ws" or "wss".
-        This is normally decided by HTTPServer, but applications
-        may wish to override this if they are using an SSL proxy
-        that does not provide the X-Scheme header as understood
-        by HTTPServer.
-        Note that this is only used by the draft76 protocol.
-        """
-        return "wss" if self.request.protocol == "https" else "ws"
-    
-
-
-# No modifications from tornado-3.2.2 below this line
-
-class WebSocketProtocol(object):
-    """Base class for WebSocket protocol versions.
-    """
-    def __init__(self, handler):
-        self.handler = handler
-        self.request = handler.request
-        self.stream = handler.stream
-        self.client_terminated = False
-        self.server_terminated = False
-
-    def async_callback(self, callback, *args, **kwargs):
-        """Wrap callbacks with this if they are used on asynchronous requests.
-
-        Catches exceptions properly and closes this WebSocket if an exception
-        is uncaught.
-        """
-        if args or kwargs:
-            callback = functools.partial(callback, *args, **kwargs)
-
-        def wrapper(*args, **kwargs):
-            try:
-                return callback(*args, **kwargs)
-            except Exception:
-                app_log.error("Uncaught exception in %s",
-                              self.request.path, exc_info=True)
-                self._abort()
-        return wrapper
-
-    def on_connection_close(self):
-        self._abort()
-
-    def _abort(self):
-        """Instantly aborts the WebSocket connection by closing the socket"""
-        self.client_terminated = True
-        self.server_terminated = True
-        self.stream.close()  # forcibly tear down the connection
-        self.close()  # let the subclass cleanup
-
-
-class WebSocketProtocol76(WebSocketProtocol):
-    """Implementation of the WebSockets protocol, version hixie-76.
-
-    This class provides basic functionality to process WebSockets requests as
-    specified in
-    http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
-    """
-    def __init__(self, handler):
-        WebSocketProtocol.__init__(self, handler)
-        self.challenge = None
-        self._waiting = None
-
-    def accept_connection(self):
-        try:
-            self._handle_websocket_headers()
-        except ValueError:
-            gen_log.debug("Malformed WebSocket request received")
-            self._abort()
-            return
-
-        scheme = self.handler.get_websocket_scheme()
-
-        # draft76 only allows a single subprotocol
-        subprotocol_header = ''
-        subprotocol = self.request.headers.get("Sec-WebSocket-Protocol", None)
-        if subprotocol:
-            selected = self.handler.select_subprotocol([subprotocol])
-            if selected:
-                assert selected == subprotocol
-                subprotocol_header = "Sec-WebSocket-Protocol: %s\r\n" % selected
-
-        # Write the initial headers before attempting to read the challenge.
-        # This is necessary when using proxies (such as HAProxy), which
-        # need to see the Upgrade headers before passing through the
-        # non-HTTP traffic that follows.
-        self.stream.write(tornado.escape.utf8(
-            "HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
-            "Upgrade: WebSocket\r\n"
-            "Connection: Upgrade\r\n"
-            "Server: TornadoServer/%(version)s\r\n"
-            "Sec-WebSocket-Origin: %(origin)s\r\n"
-            "Sec-WebSocket-Location: %(scheme)s://%(host)s%(uri)s\r\n"
-            "%(subprotocol)s"
-            "\r\n" % (dict(
-                version=tornado.version,
-                origin=self.request.headers["Origin"],
-                scheme=scheme,
-                host=self.request.host,
-                uri=self.request.uri,
-                subprotocol=subprotocol_header))))
-        self.stream.read_bytes(8, self._handle_challenge)
-
-    def challenge_response(self, challenge):
-        """Generates the challenge response that's needed in the handshake
-
-        The challenge parameter should be the raw bytes as sent from the
-        client.
-        """
-        key_1 = self.request.headers.get("Sec-Websocket-Key1")
-        key_2 = self.request.headers.get("Sec-Websocket-Key2")
-        try:
-            part_1 = self._calculate_part(key_1)
-            part_2 = self._calculate_part(key_2)
-        except ValueError:
-            raise ValueError("Invalid Keys/Challenge")
-        return self._generate_challenge_response(part_1, part_2, challenge)
-
-    def _handle_challenge(self, challenge):
-        try:
-            challenge_response = self.challenge_response(challenge)
-        except ValueError:
-            gen_log.debug("Malformed key data in WebSocket request")
-            self._abort()
-            return
-        self._write_response(challenge_response)
-
-    def _write_response(self, challenge):
-        self.stream.write(challenge)
-        self.async_callback(self.handler.open)(*self.handler.open_args, **self.handler.open_kwargs)
-        self._receive_message()
-
-    def _handle_websocket_headers(self):
-        """Verifies all invariant- and required headers
-
-        If a header is missing or have an incorrect value ValueError will be
-        raised
-        """
-        fields = ("Origin", "Host", "Sec-Websocket-Key1",
-                  "Sec-Websocket-Key2")
-        if not all(map(lambda f: self.request.headers.get(f), fields)):
-            raise ValueError("Missing/Invalid WebSocket headers")
-
-    def _calculate_part(self, key):
-        """Processes the key headers and calculates their key value.
-
-        Raises ValueError when feed invalid key."""
-        # pyflakes complains about variable reuse if both of these lines use 'c'
-        number = int(''.join(c for c in key if c.isdigit()))
-        spaces = len([c2 for c2 in key if c2.isspace()])
-        try:
-            key_number = number // spaces
-        except (ValueError, ZeroDivisionError):
-            raise ValueError
-        return struct.pack(">I", key_number)
-
-    def _generate_challenge_response(self, part_1, part_2, part_3):
-        m = hashlib.md5()
-        m.update(part_1)
-        m.update(part_2)
-        m.update(part_3)
-        return m.digest()
-
-    def _receive_message(self):
-        self.stream.read_bytes(1, self._on_frame_type)
-
-    def _on_frame_type(self, byte):
-        frame_type = ord(byte)
-        if frame_type == 0x00:
-            self.stream.read_until(b"\xff", self._on_end_delimiter)
-        elif frame_type == 0xff:
-            self.stream.read_bytes(1, self._on_length_indicator)
-        else:
-            self._abort()
-
-    def _on_end_delimiter(self, frame):
-        if not self.client_terminated:
-            self.async_callback(self.handler.on_message)(
-                frame[:-1].decode("utf-8", "replace"))
-        if not self.client_terminated:
-            self._receive_message()
-
-    def _on_length_indicator(self, byte):
-        if ord(byte) != 0x00:
-            self._abort()
-            return
-        self.client_terminated = True
-        self.close()
-
-    def write_message(self, message, binary=False):
-        """Sends the given message to the client of this Web Socket."""
-        if binary:
-            raise ValueError(
-                "Binary messages not supported by this version of websockets")
-        if isinstance(message, unicode_type):
-            message = message.encode("utf-8")
-        assert isinstance(message, bytes_type)
-        self.stream.write(b"\x00" + message + b"\xff")
-
-    def write_ping(self, data):
-        """Send ping frame."""
-        raise ValueError("Ping messages not supported by this version of websockets")
-
-    def close(self):
-        """Closes the WebSocket connection."""
-        if not self.server_terminated:
-            if not self.stream.closed():
-                self.stream.write("\xff\x00")
-            self.server_terminated = True
-        if self.client_terminated:
-            if self._waiting is not None:
-                self.stream.io_loop.remove_timeout(self._waiting)
-            self._waiting = None
-            self.stream.close()
-        elif self._waiting is None:
-            self._waiting = self.stream.io_loop.add_timeout(
-                time.time() + 5, self._abort)
-
diff --git a/notebook/base/handlers.py b/notebook/base/handlers.py
index 2c48d5c..76651e9 100755
--- a/notebook/base/handlers.py
+++ b/notebook/base/handlers.py
@@ -5,6 +5,7 @@
 
 import functools
 import json
+import mimetypes
 import os
 import re
 import sys
@@ -39,7 +40,12 @@ from notebook.services.security import csp_report_uri
 #-----------------------------------------------------------------------------
 non_alphanum = re.compile(r'[^A-Za-z0-9]')
 
-sys_info = json.dumps(get_sys_info())
+_sys_info_cache = None
+def json_sys_info():
+    global _sys_info_cache
+    if _sys_info_cache is None:
+        _sys_info_cache = json.dumps(get_sys_info())
+    return _sys_info_cache
 
 def log():
     if Application.initialized():
@@ -56,20 +62,24 @@ class AuthenticatedHandler(web.RequestHandler):
         
         Can be overridden by defining Content-Security-Policy in settings['headers']
         """
+        if 'Content-Security-Policy' in self.settings.get('headers', {}):
+            # user-specified, don't override
+            return self.settings['headers']['Content-Security-Policy']
+
         return '; '.join([
             "frame-ancestors 'self'",
             # Make sure the report-uri is relative to the base_url
-            "report-uri " + url_path_join(self.base_url, csp_report_uri),
+            "report-uri " + self.settings.get('csp_report_uri', url_path_join(self.base_url, csp_report_uri)),
         ])
 
     def set_default_headers(self):
-        headers = self.settings.get('headers', {})
+        headers = {}
+        headers.update(self.settings.get('headers', {}))
 
-        if "Content-Security-Policy" not in headers:
-            headers["Content-Security-Policy"] = self.content_security_policy
+        headers["Content-Security-Policy"] = self.content_security_policy
 
         # Allow for overriding headers
-        for header_name,value in headers.items() :
+        for header_name, value in headers.items():
             try:
                 self.set_header(header_name, value)
             except Exception as e:
@@ -357,7 +367,7 @@ class IPythonHandler(AuthenticatedHandler):
             login_available=self.login_available,
             token_available=bool(self.token or self.one_time_token),
             static_url=self.static_url,
-            sys_info=sys_info,
+            sys_info=json_sys_info(),
             contents_js_source=self.contents_js_source,
             version_hash=self.version_hash,
             ignore_minified_js=self.ignore_minified_js,
@@ -466,13 +476,27 @@ class AuthenticatedFileHandler(IPythonHandler, web.StaticFileHandler):
 
     @web.authenticated
     def get(self, path):
-        if os.path.splitext(path)[1] == '.ipynb':
+        if os.path.splitext(path)[1] == '.ipynb' or self.get_argument("download", False):
             name = path.rsplit('/', 1)[-1]
-            self.set_header('Content-Type', 'application/json')
             self.set_header('Content-Disposition','attachment; filename="%s"' % escape.url_escape(name))
-        
+
         return web.StaticFileHandler.get(self, path)
     
+    def get_content_type(self):
+        path = self.absolute_path.strip('/')
+        if '/' in path:
+            _, name = path.rsplit('/', 1)
+        else:
+            name = path
+        if name.endswith('.ipynb'):
+            return 'application/x-ipynb+json'
+        else:
+            cur_mime = mimetypes.guess_type(name)[0]
+            if cur_mime == 'text/plain':
+                return 'text/plain; charset=UTF-8'
+            else:
+                return super(AuthenticatedFileHandler, self).get_content_type()
+
     def set_headers(self):
         super(AuthenticatedFileHandler, self).set_headers()
         # disable browser caching, rely on 304 replies for savings
@@ -684,5 +708,6 @@ path_regex = r"(?P<path>(?:(?:/[^/]+)+|/?))"
 
 default_handlers = [
     (r".*/", TrailingSlashHandler),
-    (r"api", APIVersionHandler)
+    (r"api", APIVersionHandler),
+    (r'/(robots\.txt|favicon\.ico)', web.StaticFileHandler),
 ]
diff --git a/notebook/base/zmqhandlers.py b/notebook/base/zmqhandlers.py
index 66e31eb..c922d10 100644
... 21062 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/jupyter-notebook.git



More information about the Python-modules-commits mailing list