Uploaded Test files

This commit is contained in:
Batuhan Berk Başoğlu 2020-11-12 11:05:57 -05:00
parent f584ad9d97
commit 2e81cb7d99
16627 changed files with 2065359 additions and 102444 deletions

View file

@ -0,0 +1,17 @@
import sys
import subprocess
from .client import NotebookClient, execute # noqa: F401
from ._version import version as __version__ # noqa: F401
def _cleanup() -> None:
pass
# patch subprocess on Windows for python<3.7
# see https://bugs.python.org/issue37380
# the fix for python3.7: https://github.com/python/cpython/pull/15706/files
if sys.platform == 'win32':
if sys.version_info < (3, 7):
subprocess._cleanup = _cleanup
subprocess._active = None

View file

@ -0,0 +1 @@
version = '0.5.1'

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,119 @@
from typing import Dict
from nbformat import NotebookNode
class CellControlSignal(Exception):
"""
A custom exception used to indicate that the exception is used for cell
control actions (not the best model, but it's needed to cover existing
behavior without major refactors).
"""
pass
class CellTimeoutError(TimeoutError, CellControlSignal):
"""
A custom exception to capture when a cell has timed out during execution.
"""
@classmethod
def error_from_timeout_and_cell(
cls,
msg: str,
timeout: int,
cell: NotebookNode):
if cell and cell.source:
src_by_lines = cell.source.strip().split("\n")
src = (
cell.source
if len(src_by_lines) < 11
else "{}\n...\n{}".format(src_by_lines[:5], src_by_lines[-5:])
)
else:
src = "Cell contents not found."
return cls(timeout_err_msg.format(timeout=timeout, msg=msg, cell_contents=src))
class DeadKernelError(RuntimeError):
pass
class CellExecutionComplete(CellControlSignal):
"""
Used as a control signal for cell execution across execute_cell and
process_message function calls. Raised when all execution requests
are completed and no further messages are expected from the kernel
over zeromq channels.
"""
pass
class CellExecutionError(CellControlSignal):
"""
Custom exception to propagate exceptions that are raised during
notebook execution to the caller. This is mostly useful when
using nbconvert as a library, since it allows to deal with
failures gracefully.
"""
def __init__(
self,
traceback: str,
ename: str,
evalue: str) -> None:
super(CellExecutionError, self).__init__(traceback)
self.traceback = traceback
self.ename = ename
self.evalue = evalue
def __str__(self) -> str:
s = self.__unicode__()
if not isinstance(s, str):
s = s.encode('utf8', 'replace')
return s
def __unicode__(self) -> str:
return self.traceback
@classmethod
def from_cell_and_msg(
cls,
cell: NotebookNode,
msg: Dict):
"""Instantiate from a code cell object and a message contents
(message is either execute_reply or error)
"""
tb = '\n'.join(msg.get('traceback', []))
return cls(
exec_err_msg.format(
cell=cell,
traceback=tb,
ename=msg.get('ename', '<Error>'),
evalue=msg.get('evalue', ''),
),
ename=msg.get('ename', '<Error>'),
evalue=msg.get('evalue', '')
)
exec_err_msg: str = u"""\
An error occurred while executing the following cell:
------------------
{cell.source}
------------------
{traceback}
{ename}: {evalue}
"""
timeout_err_msg: str = u"""\
A cell timed out while it was being executed, after {timeout} seconds.
The message was: {msg}.
Here is a preview of the cell contents:
-------------------
{cell_contents}
-------------------
"""

View file

@ -0,0 +1,206 @@
"""Utilities to manipulate JSON objects."""
# NOTE: this is a copy of ipykernel/jsonutils.py (+blackified)
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from binascii import b2a_base64
import math
import re
import types
from datetime import datetime
import numbers
from typing import Dict
from ipython_genutils import py3compat
from ipython_genutils.py3compat import unicode_type, iteritems
next_attr_name = '__next__' if py3compat.PY3 else 'next'
# -----------------------------------------------------------------------------
# Globals and constants
# -----------------------------------------------------------------------------
# timestamp formats
ISO8601 = "%Y-%m-%dT%H:%M:%S.%f"
ISO8601_PAT = re.compile(
r"^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d{1,6})?Z?([\+\-]\d{2}:?\d{2})?$"
)
# holy crap, strptime is not threadsafe.
# Calling it once at import seems to help.
datetime.strptime("1", "%d")
# -----------------------------------------------------------------------------
# Classes and functions
# -----------------------------------------------------------------------------
# constants for identifying png/jpeg data
PNG = b'\x89PNG\r\n\x1a\n'
# front of PNG base64-encoded
PNG64 = b'iVBORw0KG'
JPEG = b'\xff\xd8'
# front of JPEG base64-encoded
JPEG64 = b'/9'
# constants for identifying gif data
GIF_64 = b'R0lGODdh'
GIF89_64 = b'R0lGODlh'
# front of PDF base64-encoded
PDF64 = b'JVBER'
def encode_images(format_dict: Dict) -> Dict[str, str]:
"""b64-encodes images in a displaypub format dict
Perhaps this should be handled in json_clean itself?
Parameters
----------
format_dict : dict
A dictionary of display data keyed by mime-type
Returns
-------
format_dict : dict
A copy of the same dictionary,
but binary image data ('image/png', 'image/jpeg' or 'application/pdf')
is base64-encoded.
"""
# no need for handling of ambiguous bytestrings on Python 3,
# where bytes objects always represent binary data and thus
# base64-encoded.
if py3compat.PY3:
return format_dict
encoded = format_dict.copy()
pngdata = format_dict.get('image/png')
if isinstance(pngdata, bytes):
# make sure we don't double-encode
if not pngdata.startswith(PNG64):
pngdata = b2a_base64(pngdata)
encoded['image/png'] = pngdata.decode('ascii')
jpegdata = format_dict.get('image/jpeg')
if isinstance(jpegdata, bytes):
# make sure we don't double-encode
if not jpegdata.startswith(JPEG64):
jpegdata = b2a_base64(jpegdata)
encoded['image/jpeg'] = jpegdata.decode('ascii')
gifdata = format_dict.get('image/gif')
if isinstance(gifdata, bytes):
# make sure we don't double-encode
if not gifdata.startswith((GIF_64, GIF89_64)):
gifdata = b2a_base64(gifdata)
encoded['image/gif'] = gifdata.decode('ascii')
pdfdata = format_dict.get('application/pdf')
if isinstance(pdfdata, bytes):
# make sure we don't double-encode
if not pdfdata.startswith(PDF64):
pdfdata = b2a_base64(pdfdata)
encoded['application/pdf'] = pdfdata.decode('ascii')
return encoded
def json_clean(obj):
"""Clean an object to ensure it's safe to encode in JSON.
Atomic, immutable objects are returned unmodified. Sets and tuples are
converted to lists, lists are copied and dicts are also copied.
Note: dicts whose keys could cause collisions upon encoding (such as a dict
with both the number 1 and the string '1' as keys) will cause a ValueError
to be raised.
Parameters
----------
obj : any python object
Returns
-------
out : object
A version of the input which will not cause an encoding error when
encoded as JSON. Note that this function does not *encode* its inputs,
it simply sanitizes it so that there will be no encoding errors later.
"""
# types that are 'atomic' and ok in json as-is.
atomic_ok = (unicode_type, type(None))
# containers that we need to convert into lists
container_to_list = (tuple, set, types.GeneratorType)
# Since bools are a subtype of Integrals, which are a subtype of Reals,
# we have to check them in that order.
if isinstance(obj, bool):
return obj
if isinstance(obj, numbers.Integral):
# cast int to int, in case subclasses override __str__ (e.g. boost enum, #4598)
return int(obj)
if isinstance(obj, numbers.Real):
# cast out-of-range floats to their reprs
if math.isnan(obj) or math.isinf(obj):
return repr(obj)
return float(obj)
if isinstance(obj, atomic_ok):
return obj
if isinstance(obj, bytes):
if py3compat.PY3:
# unanmbiguous binary data is base64-encoded
# (this probably should have happened upstream)
return b2a_base64(obj).decode('ascii')
else:
# Python 2 bytestr is ambiguous,
# needs special handling for possible binary bytestrings.
# imperfect workaround: if ascii, assume text.
# otherwise assume binary, base64-encode (py3 behavior).
try:
return obj.decode('ascii')
except UnicodeDecodeError:
return b2a_base64(obj).decode('ascii')
if isinstance(obj, container_to_list) or (
hasattr(obj, '__iter__') and hasattr(obj, next_attr_name)
):
obj = list(obj)
if isinstance(obj, list):
return [json_clean(x) for x in obj]
if isinstance(obj, dict):
# First, validate that the dict won't lose data in conversion due to
# key collisions after stringification. This can happen with keys like
# True and 'true' or 1 and '1', which collide in JSON.
nkeys = len(obj)
nkeys_collapsed = len(set(map(unicode_type, obj)))
if nkeys != nkeys_collapsed:
raise ValueError(
'dict cannot be safely converted to JSON: '
'key collision would lead to dropped values'
)
# If all OK, proceed by making the new dict that will be json-safe
out = {}
for k, v in iteritems(obj):
out[unicode_type(k)] = json_clean(v)
return out
if isinstance(obj, datetime):
return obj.strftime(ISO8601)
# we don't understand it, it's probably an unserializable object
raise ValueError("Can't clean for JSON: %r" % obj)

View file

@ -0,0 +1,116 @@
from .jsonutil import json_clean
from nbformat.v4 import output_from_msg
from typing import Dict, List, Any, Optional
from jupyter_client.client import KernelClient
class OutputWidget:
"""This class mimics a front end output widget"""
def __init__(
self,
comm_id: str,
state: Dict[str, Any],
kernel_client: KernelClient,
executor) -> None:
self.comm_id: str = comm_id
self.state: Dict[str, Any] = state
self.kernel_client: KernelClient = kernel_client
self.executor = executor
self.topic: bytes = ('comm-%s' % self.comm_id).encode('ascii')
self.outputs: List = self.state['outputs']
self.clear_before_next_output: bool = False
def clear_output(
self,
outs: List,
msg: Dict,
cell_index: int) -> None:
self.parent_header = msg['parent_header']
content = msg['content']
if content.get('wait'):
self.clear_before_next_output = True
else:
self.outputs = []
# sync back the state to the kernel
self.sync_state()
if hasattr(self.executor, 'widget_state'):
# sync the state to the nbconvert state as well, since that is used for testing
self.executor.widget_state[self.comm_id]['outputs'] = self.outputs
def sync_state(self) -> None:
state = {'outputs': self.outputs}
msg = {'method': 'update', 'state': state, 'buffer_paths': []}
self.send(msg)
def _publish_msg(
self,
msg_type: str,
data: Optional[Dict] = None,
metadata: Optional[Dict] = None,
buffers: Optional[List] = None,
**keys) -> None:
"""Helper for sending a comm message on IOPub"""
data = {} if data is None else data
metadata = {} if metadata is None else metadata
content = json_clean(dict(data=data, comm_id=self.comm_id, **keys))
msg = self.kernel_client.session.msg(msg_type, content=content, parent=self.parent_header,
metadata=metadata)
self.kernel_client.shell_channel.send(msg)
def send(
self,
data: Optional[Dict] = None,
metadata: Optional[Dict] = None,
buffers: Optional[List] = None) -> None:
self._publish_msg('comm_msg', data=data, metadata=metadata, buffers=buffers)
def output(
self,
outs: List,
msg: Dict,
display_id: str,
cell_index: int) -> None:
if self.clear_before_next_output:
self.outputs = []
self.clear_before_next_output = False
self.parent_header = msg['parent_header']
output = output_from_msg(msg)
if self.outputs:
# try to coalesce/merge output text
last_output = self.outputs[-1]
if (last_output['output_type'] == 'stream'
and output['output_type'] == 'stream'
and last_output['name'] == output['name']):
last_output['text'] += output['text']
else:
self.outputs.append(output)
else:
self.outputs.append(output)
self.sync_state()
if hasattr(self.executor, 'widget_state'):
# sync the state to the nbconvert state as well, since that is used for testing
self.executor.widget_state[self.comm_id]['outputs'] = self.outputs
def set_state(self, state: Dict) -> None:
if 'msg_id' in state:
msg_id = state.get('msg_id')
if msg_id:
self.executor.register_output_hook(msg_id, self)
self.msg_id = msg_id
else:
self.executor.remove_output_hook(self.msg_id, self)
self.msg_id = msg_id
def handle_msg(self, msg: Dict) -> None:
content = msg['content']
comm_id = content['comm_id']
assert comm_id == self.comm_id
data = content['data']
if 'state' in data:
self.set_state(data['state'])

View file

@ -0,0 +1,50 @@
import unittest
from nbformat import v4 as nbformat
class NBClientTestsBase(unittest.TestCase):
def build_notebook(self, with_json_outputs=False):
"""Build a notebook in memory for use with NotebookClient tests"""
outputs = [
nbformat.new_output("stream", name="stdout", text="a"),
nbformat.new_output("display_data", data={'text/plain': 'b'}),
nbformat.new_output("stream", name="stdout", text="c"),
nbformat.new_output("stream", name="stdout", text="d"),
nbformat.new_output("stream", name="stderr", text="e"),
nbformat.new_output("stream", name="stderr", text="f"),
nbformat.new_output("display_data", data={'image/png': 'Zw=='}), # g
nbformat.new_output("display_data", data={'application/pdf': 'aA=='}), # h
]
if with_json_outputs:
outputs.extend(
[
nbformat.new_output("display_data", data={'application/json': [1, 2, 3]}), # j
nbformat.new_output(
"display_data", data={'application/json': {'a': 1, 'c': {'b': 2}}}
), # k
nbformat.new_output("display_data", data={'application/json': 'abc'}), # l
nbformat.new_output("display_data", data={'application/json': 15.03}), # m
]
)
cells = [
nbformat.new_code_cell(source="$ e $", execution_count=1, outputs=outputs),
nbformat.new_markdown_cell(source="$ e $"),
]
return nbformat.new_notebook(cells=cells)
def build_resources(self):
"""Build an empty resources dictionary."""
return {'metadata': {}}
@classmethod
def merge_dicts(cls, *dict_args):
# Because this is annoying to do inline
outcome = {}
for d in dict_args:
outcome.update(d)
return outcome

View file

@ -0,0 +1,20 @@
from jupyter_client.manager import AsyncKernelManager
class FakeCustomKernelManager(AsyncKernelManager):
expected_methods = {'__init__': 0, 'client': 0, 'start_kernel': 0}
def __init__(self, *args, **kwargs):
self.log.info('FakeCustomKernelManager initialized')
self.expected_methods['__init__'] += 1
super(FakeCustomKernelManager, self).__init__(*args, **kwargs)
async def start_kernel(self, *args, **kwargs):
self.log.info('FakeCustomKernelManager started a kernel')
self.expected_methods['start_kernel'] += 1
return await super(FakeCustomKernelManager, self).start_kernel(*args, **kwargs)
def client(self, *args, **kwargs):
self.log.info('FakeCustomKernelManager created a client')
self.expected_methods['client'] += 1
return super(FakeCustomKernelManager, self).client(*args, **kwargs)

View file

@ -0,0 +1,37 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import signal\n",
"pid = os.getpid()\n",
"os.kill(pid, signal.SIGTERM)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}

View file

@ -0,0 +1,28 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from IPython import get_ipython"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"ip = get_ipython()\n",
"assert ip.history_manager.hist_file == ':memory:'"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,206 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from __future__ import print_function\n",
"from IPython.display import clear_output"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9\n"
]
}
],
"source": [
"for i in range(10):\n",
" clear_output()\n",
" print(i)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"print(\"Hello world\")\n",
"clear_output()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello world"
]
}
],
"source": [
"print(\"Hello world\", end='')\n",
"clear_output(wait=True) # no output after this"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"world"
]
}
],
"source": [
"print(\"Hello\", end='')\n",
"clear_output(wait=True) # here we have new output after wait=True\n",
"print(\"world\", end='')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Hello world'"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"handle0 = display(\"Hello world\", display_id=\"id0\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'world'"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"handle1 = display(\"Hello\", display_id=\"id1\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"handle1.update('world')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"handle2 = display(\"Hello world\", display_id=\"id2\")\n",
"clear_output() # clears all output, also with display_ids"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Hello world'"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"handle3 = display(\"Hello world\", display_id=\"id3\")\n",
"clear_output(wait=True)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"world"
]
}
],
"source": [
"handle4 = display(\"Hello\", display_id=\"id4\")\n",
"clear_output(wait=True)\n",
"print('world', end='')"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"handle4.update('Hello world') # it is cleared, so it should not show up in the above cell"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

View file

@ -0,0 +1,23 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"try:\n",
" input = raw_input\n",
"except:\n",
" pass\n",
"\n",
"name = input(\"name: \")"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,79 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Test that executing skips over an empty cell."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Code 1'"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"Code 1\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'Code 2'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"Code 2\""
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,48 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"i, j = 1, 1"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2\n",
"3\n",
"5\n",
"8\n",
"13\n",
"21\n",
"34\n",
"55\n",
"89\n",
"144\n"
]
}
],
"source": [
"for m in range(10):\n",
" i, j = j, i + j\n",
" print(j)"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,26 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Hello World\n"
]
}
],
"source": [
"print(\"Hello World\")"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,196 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from IPython.display import Image"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/png": [
"iVBORw0KGgoAAAANSUhEUgAAAMgAAABQCAYAAABcbTqwAAAABHNCSVQICAgIfAhkiAAAABl0RVh0\n",
"U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7Z15eJNV2vDvJ0/2vUmapk3b\n",
"dG9pKYWyFARkd6GojOI2vs6HfjqKI17i+LnNfM68LpfMq4KjM6/44jbgqKCfKLIoUFrWUigglO5N\n",
"1yxttmZfnzzP90dImrZpmqY75nddVZJnO0nOfc597u0gBEFUQ4wYMUJCmuwGxIgxlYkJSIwYYYgJ\n",
"SIwYYYgJSIwYYYgJSIxh8Xg8SHV1Na+srEw42W2ZaMiT3YAYU5vLly9zdu7cmeXxeEh5eXnGVatW\n",
"6Se7TRPJlBGQbqONcr5Rzdaa7BSDxUExWl1ko81JNtmcFLPNRTbZnWTMi5PYdCrGYVAxLouK8ehU\n",
"jMemYVwmDeOz6Vg8j+lZXJBqEXAY2GR/nhsFq9VK8Xg8v1pNY1IF5Gy9in2yVsG72NLD69QYGQAI\n",
"ABAABMD1/wx4TYDR6qQYrQ4KaAGACDoHfK9JCEIUyESWFUXpvQ+sKNSjKImAGDGiZFIExGBxkl/b\n",
"U5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0l1ZTNo+Cd/frTp\n",
"7S8OS8urG4R7j52X7D3mO0Yho/jNxTmGJ36zvHtGev8NcG6alWV9//mHmv9r96GUGrmS7ffIC7gs\n",
"T4Y03v7mprvl65bOjnqPQ4QgiOpoL46K7o+lYPxJAgBDV0mMprIiWQggvAMgbhWA9TKA9juf4Pin\n",
"5LhVWkh7pXNcP1sQap2Jctsz784CAHj/+YealhXnWowWOypXaGiaXjOlIEPqCOcEHIjZ5kCvNncx\n",
"4uO4WHZqgpMUYepvZ7eeKhXHudEw4OU8RgAAAbxJREFUXuR2lY6aliSKqC1eHAdFj4HaqtTSeGym\n",
"NytF7OKyQs9gLg+G4DiOkFGUCGfqHojZ5kDlCg2t12InZyTFO1MkgrDt92O02NH6djUjK0Xs9K/n\n",
"RsvECwjhRaDjT9ngbOGMqYCE86QzMm2Q849GIFEnrIxjV4+Bum7Le4UAAP/94sONi4uyJ2z2ijF2\n",
"TLyZF0EJSH5ZDqy5Q8YYjSmsmWbIeEM+kcIB0F/FGsnoGWNqMTmedDLPCykvt4HpRC/0fJYKXvPY\n",
"716FsjFIfLQLRHdMjCAOwB1kUYkJyPRlckNNeMuMwL3JBKbTPDAeE4G9jje6YtYIADPfDHGr9CBY\n",
"bQTS5G1yEzyDRGN/jzE1mPxYLIRCAH+FEfgrjOAxkMF2lQ32OjY4mlng6mKGLRWEUHGgp9mAmWMD\n",
"Zr4V2EU2oAjGZHE2WrCgGKZoPLgxpgaTLyDBUAQY8Jcbgb+8zyzntZHAo6cAZiAD7iYByvICyvEC\n",
"mesFlIsBMjWjZThMulfEZ7t1Ris1pmJNXybeivUrAicIOHulmV2YlRI2XyHG1CUmIDFihGFq6icx\n",
"YkwRYgISI0YYYgISI0YY/j+SFgT3yDrlYgAAAABJRU5ErkJggg==\n"
],
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"Image('python.png')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,49 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-31d18a52bf41>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mwhile\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"while True: continue"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"done\n"
]
}
],
"source": [
"print(\"done\")"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,94 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f46f26da84b54255bccc3a69d7eb08de",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Label(value='Hello World')"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets\n",
"label = ipywidgets.Label('Hello World')\n",
"label"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# it should also handle custom msg'es\n",
"label.send({'msg': 'Hello'})"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {
"8273e8fe9d9941a4a63c062158e0a630": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.4.0",
"model_name": "DescriptionStyleModel",
"state": {
"description_width": ""
}
},
"a72770a4f541425f8fe85833a3dc2a8e": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.4.0",
"model_name": "LabelModel",
"state": {
"context_menu": null,
"layout": "IPY_MODEL_dec20f599109458ca607b1df5959469b",
"style": "IPY_MODEL_8273e8fe9d9941a4a63c062158e0a630",
"value": "Hello World"
}
},
"dec20f599109458ca607b1df5959469b": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.1.0",
"model_name": "LayoutModel",
"state": {}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,67 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-05-29T11:16:26.365338Z",
"start_time": "2020-05-29T11:16:26.362047Z"
}
},
"outputs": [],
"source": [
"from ipykernel.comm import Comm"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-05-29T11:16:26.377700Z",
"start_time": "2020-05-29T11:16:26.371603Z"
}
},
"outputs": [],
"source": [
"comm = Comm('this-comm-tests-a-missing-handler', data={'id': 'foo'})"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-05-29T11:16:26.584520Z",
"start_time": "2020-05-29T11:16:26.581213Z"
}
},
"outputs": [],
"source": [
"comm.send(data={'id': 'bar'})"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,776 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "e152547dd69d46fcbcb602cf9f92e50b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"from IPython.display import clear_output\n",
"output1 = widgets.Output()\n",
"output1"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hi\n"
]
}
],
"source": [
"print(\"hi\")\n",
"with output1:\n",
" print(\"in output\")"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"with output1:\n",
" raise ValueError(\"trigger msg_type=error\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "44dc393cd7c6461a8c4901f85becfc0e",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"output2 = widgets.Output()\n",
"output2"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hi2\n"
]
}
],
"source": [
"print(\"hi2\")\n",
"with output2:\n",
" print(\"in output2\")\n",
" clear_output(wait=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "d6cd7a1de3494d2daff23c6d4ffe42ee",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"output3 = widgets.Output()\n",
"output3"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hi3\n"
]
}
],
"source": [
"print(\"hi3\")\n",
"with output3:\n",
" print(\"hello\")\n",
" clear_output(wait=True)\n",
" print(\"world\")"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "10517a9d5b1d4ea386945642894dd898",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"output4 = widgets.Output()\n",
"output4"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"hi4\n"
]
}
],
"source": [
"print(\"hi4\")\n",
"with output4:\n",
" print(\"hello world\")\n",
" clear_output()"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "37f7ba6a9ecc4c19b519e718cd12aafe",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"output5 = widgets.Output()\n",
"output5"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"print(\"hi5\")\n",
"with output5:\n",
" display(\"hello world\") # this is not a stream but plain text\n",
"clear_output()"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4fb0ee7e557440109c08547514f03c7b",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import ipywidgets as widgets\n",
"output_outer = widgets.Output()\n",
"output_inner = widgets.Output()\n",
"output_inner"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "01ea355e26484c13b1caaaf6d29ac0f2",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"output_outer"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"with output_inner:\n",
" print('in inner')\n",
" with output_outer:\n",
" print('in outer')\n",
" print('also in inner')"
]
}
],
"metadata": {
"kernelspec": {
"language": "python"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {
"01ea355e26484c13b1caaaf6d29ac0f2": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_7213e178683c4d0682b3c848a2452cf1",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in outer\n"
}
]
}
},
"025929abe8a143a08ad23de9e99c610f": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"03c04d8645a74c4dac2e08e2142122a6": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"091f6e59c48442b1bdb13320b4f6605d": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"10517a9d5b1d4ea386945642894dd898": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_2c67de94f62d4887866d22abca7f6f13"
}
},
"106de0ded502439c873de5449248b00c": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"1b9529b98aaf40ccbbf38e178796be88": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"22592f3cb7674cb79cc60def5e8bc060": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"2468aac6020349139ee6236b5dde0310": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_d5e88b6a26114d6da0b7af215aa2c3bb"
}
},
"2955dc9c531c4c6b80086da240d0df13": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_1b9529b98aaf40ccbbf38e178796be88",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "world\n"
}
]
}
},
"2c67de94f62d4887866d22abca7f6f13": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"37f7ba6a9ecc4c19b519e718cd12aafe": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_03c04d8645a74c4dac2e08e2142122a6",
"outputs": [
{
"data": {
"text/plain": "'hello world'"
},
"metadata": {},
"output_type": "display_data"
}
]
}
},
"3945ce528fbf40dc830767281892ea56": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"3c6bb7a6fd4f4f8786d30ef7b2c7c050": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"3e0e8f5d18fe4992b11e1d5c13faecdf": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"44dc393cd7c6461a8c4901f85becfc0e": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_3c6bb7a6fd4f4f8786d30ef7b2c7c050",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output2\n"
}
]
}
},
"45823daa739447a6ba5393e45204ec8e": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_3e0e8f5d18fe4992b11e1d5c13faecdf",
"outputs": [
{
"data": {
"text/plain": "'hello world'"
},
"metadata": {},
"output_type": "display_data"
}
]
}
},
"4fa2d1a41bd64017a20e358526ad9cf3": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_6490daaa1d2e42a0aef909e7b8c8eff4",
"outputs": [
{
"data": {
"text/plain": "'hello world'"
},
"metadata": {},
"output_type": "display_data"
}
]
}
},
"4fb0ee7e557440109c08547514f03c7b": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_dbf140d66ba247b7847c0f5642b7f607",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in inner\nalso in inner\n"
}
]
}
},
"55aff5c4b53f440a868919f042cf9c14": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_a14653416772496aabed04b4719268ef",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in inner\nalso in inner\n"
}
]
}
},
"5747ce87279c44519b9df62799e25e6f": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_6ef78dc31eec422ab2afce4be129836f",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output2\n"
}
]
}
},
"6490daaa1d2e42a0aef909e7b8c8eff4": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"6ef78dc31eec422ab2afce4be129836f": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"7134e81fdb364a738c1e58b26ec0d008": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_025929abe8a143a08ad23de9e99c610f",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in inner\nalso in inner\n"
}
]
}
},
"7213e178683c4d0682b3c848a2452cf1": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"804b6628ca0a48dfbad930615626b1fb": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"a14653416772496aabed04b4719268ef": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"a32671b19b814cf5bd964c36368f9f79": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_c843c22ff72e4983984ca4d62ce68e2b",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in outer\n"
}
]
}
},
"aaf673ac9c774aaba4f751db2f3dd6c5": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_106de0ded502439c873de5449248b00c",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output2\n"
}
]
}
},
"bc3d9af2591e4a52af73921f46d79efa": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_22592f3cb7674cb79cc60def5e8bc060"
}
},
"c843c22ff72e4983984ca4d62ce68e2b": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"cc022dc8b5584570a04facf68f9bdf0b": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_3945ce528fbf40dc830767281892ea56",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in outer\n"
}
]
}
},
"d0cb56db68f2485480da1b2a43ad3c02": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_df4468e2240a430599a01e731472c319",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output\n"
},
{
"ename": "ValueError",
"evalue": "trigger msg_type=error",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-15-7f84f5558b68>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0moutput1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"trigger msg_type=error\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mValueError\u001b[0m: trigger msg_type=error"
]
}
]
}
},
"d314a6ef74d947f3a2149bdf9b8b57a3": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_804b6628ca0a48dfbad930615626b1fb",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output\n"
}
]
}
},
"d5e88b6a26114d6da0b7af215aa2c3bb": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"d6cd7a1de3494d2daff23c6d4ffe42ee": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_091f6e59c48442b1bdb13320b4f6605d",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "world\n"
}
]
}
},
"dbf140d66ba247b7847c0f5642b7f607": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"de7ba4c0eed941a3b52fa940387d1415": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"df4468e2240a430599a01e731472c319": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"e152547dd69d46fcbcb602cf9f92e50b": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_de7ba4c0eed941a3b52fa940387d1415",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "in output\n"
},
{
"ename": "ValueError",
"evalue": "trigger msg_type=error",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-3-7f84f5558b68>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mwith\u001b[0m \u001b[0moutput1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"trigger msg_type=error\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mValueError\u001b[0m: trigger msg_type=error"
]
}
]
}
},
"e27795e5a4f14450b8c9590cac51cb6b": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {}
},
"e3e20af587534a9bb3fa413951ceb28d": {
"model_module": "@jupyter-widgets/output",
"model_module_version": "1.0.0",
"model_name": "OutputModel",
"state": {
"layout": "IPY_MODEL_e27795e5a4f14450b8c9590cac51cb6b",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": "world\n"
}
]
}
}
},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,84 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Ensure notebooks can execute in parallel\n",
"\n",
"This notebook uses a file system based \"lock\" to assert that two instances of the notebook kernel will run in parallel. Each instance writes to a file in a temporary directory, and then tries to read the other file from\n",
"the temporary directory, so that running them in sequence will fail, but running them in parallel will succed.\n",
"\n",
"Two notebooks are launched, each which sets the `this_notebook` variable. One notebook is set to `this_notebook = 'A'` and the other `this_notebook = 'B'`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import os.path\n",
"import tempfile\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# the variable this_notebook is injectected in a cell above by the test framework.\n",
"this_notebook = 'A'\n",
"other_notebook = 'B'\n",
"directory = os.environ['NBEXECUTE_TEST_PARALLEL_TMPDIR']\n",
"with open(os.path.join(directory, 'test_file_{}.txt'.format(this_notebook)), 'w') as f:\n",
" f.write('Hello from {}'.format(this_notebook))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"start = time.time()\n",
"timeout = 5\n",
"end = start + timeout\n",
"target_file = os.path.join(directory, 'test_file_{}.txt'.format(other_notebook))\n",
"while time.time() < end:\n",
" time.sleep(0.1)\n",
" if os.path.exists(target_file):\n",
" with open(target_file, 'r') as f:\n",
" text = f.read()\n",
" if text == 'Hello from {}'.format(other_notebook):\n",
" break\n",
"else:\n",
" assert False, \"Timed out  didn't get a message from {}\".format(other_notebook)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,84 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Ensure notebooks can execute in parallel\n",
"\n",
"This notebook uses a file system based \"lock\" to assert that two instances of the notebook kernel will run in parallel. Each instance writes to a file in a temporary directory, and then tries to read the other file from\n",
"the temporary directory, so that running them in sequence will fail, but running them in parallel will succed.\n",
"\n",
"Two notebooks are launched, each which sets the `this_notebook` variable. One notebook is set to `this_notebook = 'A'` and the other `this_notebook = 'B'`."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"import os.path\n",
"import tempfile\n",
"import time"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# the variable this_notebook is injectected in a cell above by the test framework.\n",
"this_notebook = 'B'\n",
"other_notebook = 'A'\n",
"directory = os.environ['NBEXECUTE_TEST_PARALLEL_TMPDIR']\n",
"with open(os.path.join(directory, 'test_file_{}.txt'.format(this_notebook)), 'w') as f:\n",
" f.write('Hello from {}'.format(this_notebook))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"start = time.time()\n",
"timeout = 5\n",
"end = start + timeout\n",
"target_file = os.path.join(directory, 'test_file_{}.txt'.format(other_notebook))\n",
"while time.time() < end:\n",
" time.sleep(0.1)\n",
" if os.path.exists(target_file):\n",
" with open(target_file, 'r') as f:\n",
" text = f.read()\n",
" if text == 'Hello from {}'.format(other_notebook):\n",
" break\n",
"else:\n",
" assert False, \"Timed out  didn't get a message from {}\".format(other_notebook)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,48 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from IPython.display import SVG"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"100\" width=\"100\">\n",
" <circle cx=\"50\" cy=\"50\" fill=\"red\" r=\"40\" stroke=\"black\" stroke-width=\"2\"/>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"SVG(data='''\n",
"<svg height=\"100\" width=\"100\">\n",
" <circle cx=\"50\" cy=\"50\" r=\"40\" stroke=\"black\" stroke-width=\"2\" fill=\"red\" />\n",
"</svg>''')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"tags": [
"raises-exception"
]
},
"outputs": [
{
"ename": "Exception",
"evalue": "message",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mException\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-1-644b5753a261>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;31m# üñîçø∂é\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"message\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mException\u001b[0m: message"
]
}
],
"source": [
"# üñîçø∂é\n",
"raise Exception(\"message\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"print('ok')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 1
}

View file

@ -0,0 +1,50 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"ename": "Exception",
"evalue": "message",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mException\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-1-9abc744909d9>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;31m# üñîçø∂é\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[1;32mraise\u001b[0m \u001b[0mException\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"message\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mException\u001b[0m: message"
]
}
],
"source": [
"# üñîçø∂é\n",
"raise Exception(\"message\")"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"ok\n"
]
}
],
"source": [
"print('ok')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,65 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import time\n",
"import datetime"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"t0 = datetime.datetime.utcnow()\n",
"time.sleep(1)\n",
"t1 = datetime.datetime.utcnow()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"time_format = '%Y-%m-%dT%H:%M:%S.%fZ'\n",
"print(t0.strftime(time_format), end='')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(t1.strftime(time_format), end='')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -0,0 +1,26 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u2603\n"
]
}
],
"source": [
"print('\u2603')"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

View file

@ -0,0 +1,32 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u2603\n"
]
}
],
"source": [
"print('\u2603')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View file

@ -0,0 +1,173 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"ip = get_ipython()\n",
"\n",
"from IPython.display import display\n",
"\n",
"def display_with_id(obj, display_id, update=False, execute_result=False):\n",
" iopub = ip.kernel.iopub_socket\n",
" session = get_ipython().kernel.session\n",
" data, md = ip.display_formatter.format(obj)\n",
" transient = {'display_id': str(display_id)}\n",
" content = {'data': data, 'metadata': md, 'transient': transient}\n",
" if execute_result:\n",
" msg_type = 'execute_result'\n",
" content['execution_count'] = ip.execution_count\n",
" else:\n",
" msg_type = 'update_display_data' if update else 'display_data'\n",
" session.send(iopub, msg_type, content, parent=ip.parent_header)\n"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'above'"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"'below'"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display('above')\n",
"display_with_id(1, 'here')\n",
"display('below')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"6"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_with_id(2, 'here')\n",
"display_with_id(3, 'there')\n",
"display_with_id(4, 'here')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"6"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"display_with_id(5, 'there')\n",
"display_with_id(6, 'there', update=True)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"10"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"display_with_id(7, 'here')\n",
"display_with_id(8, 'here', update=True)\n",
"display_with_id(9, 'result', execute_result=True)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"display_with_id(10, 'result', update=True)"
]
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,57 @@
import asyncio
import tornado
from nbclient.util import run_sync
@run_sync
async def some_async_function():
await asyncio.sleep(0.01)
return 42
def test_nested_asyncio_with_existing_ioloop():
ioloop = asyncio.new_event_loop()
try:
asyncio.set_event_loop(ioloop)
assert some_async_function() == 42
assert asyncio.get_event_loop() is ioloop
finally:
asyncio._set_running_loop(None) # it seems nest_asyncio doesn't reset this
def test_nested_asyncio_with_no_ioloop():
asyncio.set_event_loop(None)
try:
assert some_async_function() == 42
finally:
asyncio._set_running_loop(None) # it seems nest_asyncio doesn't reset this
def test_nested_asyncio_with_tornado():
# This tests if tornado accepts the pure-Python Futures, see
# https://github.com/tornadoweb/tornado/issues/2753
# https://github.com/erdewit/nest_asyncio/issues/23
asyncio.set_event_loop(asyncio.new_event_loop())
ioloop = tornado.ioloop.IOLoop.current()
async def some_async_function():
future = asyncio.ensure_future(asyncio.sleep(0.1))
# this future is a different future after nested-asyncio has patched
# the asyncio module, check if tornado likes it:
ioloop.add_future(future, lambda f: f.result())
await future
return 42
def some_sync_function():
return run_sync(some_async_function)()
async def run():
# calling some_async_function directly should work
assert await some_async_function() == 42
# but via a sync function (using nested-asyncio) can lead to issues:
# https://github.com/tornadoweb/tornado/issues/2753
assert some_sync_function() == 42
ioloop.run_sync(run)

View file

@ -0,0 +1,93 @@
"""General utility methods"""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import asyncio
import sys
import inspect
from typing import Callable, Awaitable, Any, Union
def check_ipython() -> None:
# original from vaex/asyncio.py
IPython = sys.modules.get('IPython')
if IPython:
IPython_version = tuple(map(int, IPython.__version__.split('.'))) # type: ignore
if IPython_version < (7, 0, 0):
raise RuntimeError(f'You are using IPython {IPython.__version__} ' # type: ignore
'while we require 7.0.0+, please update IPython')
def check_patch_tornado() -> None:
"""If tornado is imported, add the patched asyncio.Future to its tuple of acceptable Futures"""
# original from vaex/asyncio.py
if 'tornado' in sys.modules:
import tornado.concurrent # type: ignore
if asyncio.Future not in tornado.concurrent.FUTURES:
tornado.concurrent.FUTURES = \
tornado.concurrent.FUTURES + (asyncio.Future, ) # type: ignore
def just_run(coro: Awaitable) -> Any:
"""Make the coroutine run, even if there is an event loop running (using nest_asyncio)"""
# original from vaex/asyncio.py
loop = asyncio._get_running_loop()
if loop is None:
had_running_loop = False
try:
loop = asyncio.get_event_loop()
except RuntimeError:
# we can still get 'There is no current event loop in ...'
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
else:
had_running_loop = True
if had_running_loop:
# if there is a running loop, we patch using nest_asyncio
# to have reentrant event loops
check_ipython()
import nest_asyncio
nest_asyncio.apply()
check_patch_tornado()
return loop.run_until_complete(coro)
def run_sync(coro: Callable) -> Callable:
"""Runs a coroutine and blocks until it has executed.
An event loop is created if no one already exists. If an event loop is
already running, this event loop execution is nested into the already
running one if `nest_asyncio` is set to True.
Parameters
----------
coro : coroutine
The coroutine to be executed.
Returns
-------
result :
Whatever the coroutine returns.
"""
def wrapped(*args, **kwargs):
return just_run(coro(*args, **kwargs))
wrapped.__doc__ = coro.__doc__
return wrapped
async def ensure_async(obj: Union[Awaitable, Any]) -> Any:
"""Convert a non-awaitable object to a coroutine if needed,
and await it if it was not already awaited.
"""
if inspect.isawaitable(obj):
try:
result = await obj
except RuntimeError as e:
if str(e) == 'cannot reuse already awaited coroutine':
# obj is already the coroutine's result
return obj
raise
return result
# obj doesn't need to be awaited
return obj