Merge branch 'master' into test_empty_arrows

Thomas Kluyver 8 years ago committed by GitHub
commit 2941158ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -96,6 +96,8 @@ matrix:
env: GROUP=python
- python: 3.5
env: GROUP=python
- python: "3.7-dev"
env: GROUP=python
- python: 3.6
env: GROUP=docs

@ -10,7 +10,7 @@
"font-awesome": "components/font-awesome#~4.7.0",
"google-caja": "5669",
"jed": "~1.1.1",
"jquery": "components/jquery#~2.2",
"jquery": "components/jquery#~3.3",
"jquery-typeahead": "~2.0.0",
"jquery-ui": "components/jqueryui#~1.10",
"marked": "~0.3",

@ -30,7 +30,7 @@ New features:
- The files list now shows file sizes (:ghpull:`3539`)
- Add a quit button in the dashboard (:ghpull:`3004`)
- Display hostname in the terminal when running remotely (:ghpull:`3356`)
- Display hostname in the terminal when running remotely (:ghpull:`3356`, :ghpull:`3593`)
- Add slides exportation/download to the menu (:ghpull:`3287`)
- Add any extra installed nbconvert exporters to the "Download as" menu (:ghpull:`3323`)
- Editor: warning when overwriting a file that is modified on disk (:ghpull:`2783`)

@ -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, 5, 0, '.dev0')
version_info = (5, 6, 0, '.dev0')
__version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:])

@ -1339,11 +1339,10 @@ class NotebookApp(JupyterApp):
@property
def display_url(self):
hostname = socket.gethostname()
if self.ip in ('localhost', '127.0.0.1', hostname):
ip = self.ip
if self.ip in ('', '0.0.0.0'):
ip = socket.gethostname()
else:
ip = hostname
ip = self.ip
url = self._url(ip)
if self.token:
# Don't log full token if it came from config

@ -104,7 +104,8 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
@property
def kernel_info_timeout(self):
return self.settings.get('kernel_info_timeout', 10)
km_default = self.kernel_manager.kernel_info_timeout
return self.settings.get('kernel_info_timeout', km_default)
@property
def iopub_msg_rate_limit(self):

@ -19,7 +19,7 @@ from tornado.ioloop import IOLoop, PeriodicCallback
from jupyter_client.session import Session
from jupyter_client.multikernelmanager import MultiKernelManager
from traitlets import (Any, Bool, Dict, List, Unicode, TraitError, Integer,
Instance, default, validate
Float, Instance, default, validate
)
from notebook.utils import to_os_path, exists
@ -93,6 +93,18 @@ class MappingKernelManager(MultiKernelManager):
no frontends are connected.
"""
)
kernel_info_timeout = Float(60, config=True,
help="""Timeout for giving up on a kernel (in seconds).
On starting and restarting kernels, we check whether the
kernel is running and responsive by sending kernel_info_requests.
This sets the timeout in seconds for how long the kernel can take
before being presumed dead.
This affects the MappingKernelManager (which handles kernel restarts)
and the ZMQChannelsHandler (which handles the startup).
"""
)
_kernel_buffers = Any()
@default('_kernel_buffers')
@ -305,7 +317,7 @@ class MappingKernelManager(MultiKernelManager):
kernel.session.send(channel, "kernel_info_request")
channel.on_recv(on_reply)
loop = IOLoop.current()
timeout = loop.add_timeout(loop.time() + 30, on_timeout)
timeout = loop.add_timeout(loop.time() + self.kernel_info_timeout, on_timeout)
return future
def notify_connect(self, kernel_id):
@ -434,4 +446,3 @@ class MappingKernelManager(MultiKernelManager):
self.log.warning("Culling '%s' kernel '%s' (%s) with %d connections due to %s seconds of inactivity.",
kernel.execution_state, kernel.kernel_name, kernel_id, connections, idle_duration)
self.shutdown_kernel(kernel_id)

@ -73,7 +73,7 @@ define(function(){
// tree
jglobal('SessionList','tree/js/sessionlist');
Jupyter.version = "5.5.0.dev0";
Jupyter.version = "5.6.0.dev0";
Jupyter._target = '_blank';
return Jupyter;
});

@ -160,6 +160,15 @@ define([
var input = $('<div></div>').addClass('input');
this.input = input;
var run_this_cell = $('<div></div>').addClass('run_this_cell');
run_this_cell.prop('title', 'Run this cell');
run_this_cell.append('<i class="fa-step-forward fa"></i>');
run_this_cell.click(function (event) {
event.stopImmediatePropagation();
that.execute();
});
var prompt = $('<div/>').addClass('prompt input_prompt');
var inner_cell = $('<div/>').addClass('inner_cell');
this.celltoolbar = new celltoolbar.CellToolbar({
@ -180,7 +189,7 @@ define([
this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
$(this.code_mirror.getInputField()).attr("spellcheck", "false");
inner_cell.append(input_area);
input.append(prompt).append(inner_cell);
input.append(run_this_cell).append(prompt).append(inner_cell);
var output = $('<div></div>');
cell.append(input).append(output);
@ -505,6 +514,7 @@ define([
}
this.input_prompt_number = number;
var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline);
// This HTML call is okay because the user contents are escaped.
this.element.find('div.input_prompt').html(prompt_html);
this.events.trigger('set_dirty.Notebook', {value: true});

@ -163,6 +163,7 @@ define([
var allCellsButton = $('<button/>')
.append($('<i/>').addClass('fa fa-arrows-v'))
.attr('id', 'findreplace_allcells_btn')
.attr('type', 'button')
.addClass("btn btn-default btn-sm")
.attr('data-toggle','button')
@ -179,6 +180,7 @@ define([
var search = $("<input/>")
.addClass('form-control input-sm')
.attr('id', 'findreplace_find_inp')
.attr('placeholder',i18n.msg._('Find'));
var findFormGroup = $('<div/>').addClass('form-group');
@ -194,6 +196,7 @@ define([
)
var replace = $("<input/>")
.attr('id', 'findreplace_replace_inp')
.addClass('form-control input-sm')
.attr('placeholder',i18n.msg._('Replace'));
var replaceFormGroup = $('<div/>').addClass('form-group');
@ -354,7 +357,8 @@ define([
keyboard_manager: env.notebook.keyboard_manager,
buttons:{
'Replace All':{ class: "btn-primary",
click: function(event){onsubmit(event); return true;}
click: function(event){onsubmit(event); return true;},
id: "findreplace_replaceall_btn",
}
},
open: function(){

@ -27,6 +27,31 @@ div.input_prompt {
border-top: 1px solid transparent;
}
.run_this_cell {
visibility: hidden;
cursor: pointer;
color: #333;
padding-top: 5px;
padding-bottom: 5px;
padding-left: 1ex;
padding-right: 1ex;
width: 1ex;
}
div.code_cell div.input_prompt {
min-width: 11ex;
}
div.code_cell:hover .run_this_cell {
visibility: visible;
}
@media (-moz-touch-enabled: 1), (any-pointer: coarse) {
.run_this_cell {
visibility: visible;
}
}
// The styles related to div.highlight are for nbconvert HTML output only. This works
// because the .highlight div isn't present in the live notebook. We could put this into
// nbconvert, but it easily falls out of sync, can't use our less variables and doesn't

@ -0,0 +1,24 @@
import pytest
def test_find_and_replace(notebook):
""" test find and replace on all the cells """
cell_0, cell_1, cell_2, cell_3 = "hello", "hellohello", "abc", "ello"
find_str = "ello" # string to replace
replace_str = "foo" # string to replace to
# set the contents of the cells
notebook.add_cell(index=0, content=cell_0);
notebook.add_cell(index=1, content=cell_1);
notebook.add_cell(index=2, content=cell_2);
notebook.add_cell(index=3, content=cell_3);
# replace the strings
notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str)
# check content of the cells
assert notebook.get_cell_contents(0) == cell_0.replace(find_str, replace_str)
assert notebook.get_cell_contents(1) == cell_1.replace(find_str, replace_str)
assert notebook.get_cell_contents(2) == cell_2.replace(find_str, replace_str)
assert notebook.get_cell_contents(3) == cell_3.replace(find_str, replace_str)

@ -1,5 +1,5 @@
import os
import time
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
@ -100,6 +100,16 @@ class Notebook:
self.to_command_mode()
self.current_cell = cell
def find_and_replace(self, index=0, find_txt='', replace_txt=''):
self.focus_cell(index)
self.to_command_mode()
self.body.send_keys('f')
wait_for_selector(self.browser, "#find-and-replace", single=True)
self.browser.find_element_by_id("findreplace_allcells_btn").click()
self.browser.find_element_by_id("findreplace_find_inp").send_keys(find_txt)
self.browser.find_element_by_id("findreplace_replace_inp").send_keys(replace_txt)
self.browser.find_element_by_id("findreplace_replaceall_btn").click()
def convert_cell_type(self, index=0, cell_type="code"):
# TODO add check to see if it is already present
self.focus_cell(index)

@ -140,7 +140,7 @@ def is_file_hidden_posix(abs_path, stat_res=None):
if os.path.basename(abs_path).startswith('.'):
return True
if stat_res is None:
if stat_res is None or stat.S_ISLNK(stat_res.st_mode):
try:
stat_res = os.stat(abs_path)
except OSError as e:

@ -1,6 +1,9 @@
[bdist_wheel]
universal=1
[metadata]
license_file = COPYING.md
[nosetests]
warningfilters=module |.* |DeprecationWarning |notebook.*
default |.* | Warning | notebook.*

Loading…
Cancel
Save