mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
remove filter-branch residue
This commit is contained in:
parent
02d2dca939
commit
3add4a5df6
@ -1,7 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from warnings import warn
|
|
||||||
|
|
||||||
warn("IPython.utils.eventful has moved to traitlets.eventful")
|
|
||||||
|
|
||||||
from traitlets.eventful import *
|
|
@ -1,87 +0,0 @@
|
|||||||
# encoding: utf-8
|
|
||||||
"""Tests for io.py"""
|
|
||||||
|
|
||||||
# Copyright (c) IPython Development Team.
|
|
||||||
# Distributed under the terms of the Modified BSD License.
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import io as stdlib_io
|
|
||||||
import os.path
|
|
||||||
import stat
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from subprocess import Popen, PIPE
|
|
||||||
import unittest
|
|
||||||
|
|
||||||
import nose.tools as nt
|
|
||||||
|
|
||||||
from IPython.testing.decorators import skipif, skip_win32
|
|
||||||
from IPython.utils.io import Tee, capture_output
|
|
||||||
from IPython.utils.py3compat import doctest_refactor_print, PY3
|
|
||||||
from IPython.utils.tempdir import TemporaryDirectory
|
|
||||||
|
|
||||||
if PY3:
|
|
||||||
from io import StringIO
|
|
||||||
else:
|
|
||||||
from StringIO import StringIO
|
|
||||||
|
|
||||||
|
|
||||||
def test_tee_simple():
|
|
||||||
"Very simple check with stdout only"
|
|
||||||
chan = StringIO()
|
|
||||||
text = 'Hello'
|
|
||||||
tee = Tee(chan, channel='stdout')
|
|
||||||
print(text, file=chan)
|
|
||||||
nt.assert_equal(chan.getvalue(), text+"\n")
|
|
||||||
|
|
||||||
|
|
||||||
class TeeTestCase(unittest.TestCase):
|
|
||||||
|
|
||||||
def tchan(self, channel, check='close'):
|
|
||||||
trap = StringIO()
|
|
||||||
chan = StringIO()
|
|
||||||
text = 'Hello'
|
|
||||||
|
|
||||||
std_ori = getattr(sys, channel)
|
|
||||||
setattr(sys, channel, trap)
|
|
||||||
|
|
||||||
tee = Tee(chan, channel=channel)
|
|
||||||
print(text, end='', file=chan)
|
|
||||||
setattr(sys, channel, std_ori)
|
|
||||||
trap_val = trap.getvalue()
|
|
||||||
nt.assert_equal(chan.getvalue(), text)
|
|
||||||
if check=='close':
|
|
||||||
tee.close()
|
|
||||||
else:
|
|
||||||
del tee
|
|
||||||
|
|
||||||
def test(self):
|
|
||||||
for chan in ['stdout', 'stderr']:
|
|
||||||
for check in ['close', 'del']:
|
|
||||||
self.tchan(chan, check)
|
|
||||||
|
|
||||||
def test_io_init():
|
|
||||||
"""Test that io.stdin/out/err exist at startup"""
|
|
||||||
for name in ('stdin', 'stdout', 'stderr'):
|
|
||||||
cmd = doctest_refactor_print("from IPython.utils import io;print io.%s.__class__"%name)
|
|
||||||
p = Popen([sys.executable, '-c', cmd],
|
|
||||||
stdout=PIPE)
|
|
||||||
p.wait()
|
|
||||||
classname = p.stdout.read().strip().decode('ascii')
|
|
||||||
# __class__ is a reference to the class object in Python 3, so we can't
|
|
||||||
# just test for string equality.
|
|
||||||
assert 'IPython.utils.io.IOStream' in classname, classname
|
|
||||||
|
|
||||||
def test_capture_output():
|
|
||||||
"""capture_output() context works"""
|
|
||||||
|
|
||||||
with capture_output() as io:
|
|
||||||
print('hi, stdout')
|
|
||||||
print('hi, stderr', file=sys.stderr)
|
|
||||||
|
|
||||||
nt.assert_equal(io.stdout, 'hi, stdout\n')
|
|
||||||
nt.assert_equal(io.stderr, 'hi, stderr\n')
|
|
||||||
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
|||||||
# IPython Notebook development
|
|
||||||
|
|
||||||
## Development dependencies
|
|
||||||
|
|
||||||
Developers of the IPython Notebook will need to install the following tools:
|
|
||||||
|
|
||||||
* invoke
|
|
||||||
* node.js
|
|
||||||
* less (`npm install -g less`)
|
|
||||||
|
|
||||||
## Components
|
|
||||||
|
|
||||||
We are moving to a model where our JavaScript dependencies are managed using
|
|
||||||
[bower](http://bower.io/). These packages are installed in `static/components`
|
|
||||||
and committed into a separate git repo [ipython/ipython-components](ipython/ipython-components).
|
|
||||||
Our dependencies are described in the file
|
|
||||||
`static/components/bower.json`. To update our bower packages, run `bower install`
|
|
||||||
in this directory.
|
|
||||||
|
|
||||||
## less
|
|
||||||
|
|
||||||
If you edit our `.less` files you will need to run the less compiler to build
|
|
||||||
our minified css files. This can be done by running `python setup.py css` from the root of the repository.
|
|
||||||
If you are working frequently with `.less` files please consider installing git hooks that
|
|
||||||
rebuild the css files and corresponding maps in `${RepoRoot}/git-hooks/install-hooks.sh`.
|
|
||||||
|
|
||||||
## JavaScript Documentation
|
|
||||||
|
|
||||||
|
|
||||||
How to Build/ view the doc for JavaScript. JavaScript documentation should follow a
|
|
||||||
style close to JSDoc one, so you should be able to build them with your favorite
|
|
||||||
documentation builder. Still the documentation comment are mainly written to be read
|
|
||||||
with YUI doc. You can either build a static version, or start a YUIdoc server that
|
|
||||||
will live update the doc at every page request.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
To do so, you will need to install YUIdoc.
|
|
||||||
|
|
||||||
### Install NodeJS
|
|
||||||
|
|
||||||
Node is a browser less javascript interpreter. To install it please refer to
|
|
||||||
the documentation for your platform. Install also NPM (node package manager) if
|
|
||||||
it does not come bundled with it.
|
|
||||||
|
|
||||||
### Get YUIdoc
|
|
||||||
|
|
||||||
npm does by default install package in `./node_modules` instead of doing a
|
|
||||||
system wide install. I'll leave you to yuidoc docs if you want to make a system
|
|
||||||
wide install.
|
|
||||||
|
|
||||||
First, cd into js directory :
|
|
||||||
```bash
|
|
||||||
cd IPython/html/static/js/
|
|
||||||
# install yuidoc
|
|
||||||
npm install yuidocjs
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Run YUIdoc server
|
|
||||||
|
|
||||||
From IPython/html/static/js/
|
|
||||||
```bash
|
|
||||||
# run yuidoc for install dir
|
|
||||||
./node_modules/yuidocjs/lib/cli.js --server .
|
|
||||||
```
|
|
||||||
|
|
||||||
Follow the instruction and the documentation should be available on localhost:3000
|
|
||||||
|
|
||||||
Omitting `--server` will build a static version in the `out` folder by default.
|
|
Loading…
Reference in New Issue
Block a user