Show More
@@ -212,7 +212,7 b' def get_input_encoding():' | |||||
212 | #----------------------------------------------------------------------------- |
|
212 | #----------------------------------------------------------------------------- | |
213 |
|
213 | |||
214 | class InputSplitter(object): |
|
214 | class InputSplitter(object): | |
215 | """An object that can accumulate lines of Python source before execution. |
|
215 | r"""An object that can accumulate lines of Python source before execution. | |
216 |
|
216 | |||
217 | This object is designed to be fed python source line-by-line, using |
|
217 | This object is designed to be fed python source line-by-line, using | |
218 |
|
|
218 | :meth:`push`. It will return on each push whether the currently pushed |
@@ -131,9 +131,9 b' def get_default_colors():' | |||||
131 |
|
131 | |||
132 |
|
132 | |||
133 | class SeparateUnicode(Unicode): |
|
133 | class SeparateUnicode(Unicode): | |
134 | """A Unicode subclass to validate separate_in, separate_out, etc. |
|
134 | r"""A Unicode subclass to validate separate_in, separate_out, etc. | |
135 |
|
135 | |||
136 | This is a Unicode based trait that converts '0'->'' and '\\n'->'\n'. |
|
136 | This is a Unicode based trait that converts '0'->'' and ``'\\n'->'\n'``. | |
137 | """ |
|
137 | """ | |
138 |
|
138 | |||
139 | def validate(self, obj, value): |
|
139 | def validate(self, obj, value): | |
@@ -3035,15 +3035,17 b' class InteractiveShell(SingletonConfigurable):' | |||||
3035 | arguments as strings. The number before the / is the session |
|
3035 | arguments as strings. The number before the / is the session | |
3036 | number: ~n goes n back from the current session. |
|
3036 | number: ~n goes n back from the current session. | |
3037 |
|
3037 | |||
3038 | Optional Parameters: |
|
3038 | raw : bool, optional | |
3039 |
|
|
3039 | By default, the processed input is used. If this is true, the raw | |
3040 |
|
|
3040 | input history is used instead. | |
3041 |
|
3041 | |||
3042 | Note that slices can be called with two notations: |
|
3042 | Notes | |
|
3043 | ----- | |||
3043 |
|
3044 | |||
3044 | N:M -> standard python form, means including items N...(M-1). |
|
3045 | Slices can be described with two notations: | |
3045 |
|
3046 | |||
3046 | N-M -> include items N..M (closed endpoint). |
|
3047 | * ``N:M`` -> standard python form, means including items N...(M-1). | |
|
3048 | * ``N-M`` -> include items N..M (closed endpoint). | |||
3047 | """ |
|
3049 | """ | |
3048 | lines = self.history_manager.get_range_by_str(range_str, raw=raw) |
|
3050 | lines = self.history_manager.get_range_by_str(range_str, raw=raw) | |
3049 | return "\n".join(x for _, _, x in lines) |
|
3051 | return "\n".join(x for _, _, x in lines) |
@@ -579,24 +579,36 b' class Magics(Configurable):' | |||||
579 | def parse_options(self, arg_str, opt_str, *long_opts, **kw): |
|
579 | def parse_options(self, arg_str, opt_str, *long_opts, **kw): | |
580 | """Parse options passed to an argument string. |
|
580 | """Parse options passed to an argument string. | |
581 |
|
581 | |||
582 |
The interface is similar to that of getopt |
|
582 | The interface is similar to that of :func:`getopt.getopt`, but it | |
583 | Struct with the options as keys and the stripped argument string still |
|
583 | returns a :class:`~IPython.utils.struct.Struct` with the options as keys | |
584 | as a string. |
|
584 | and the stripped argument string still as a string. | |
585 |
|
585 | |||
586 | arg_str is quoted as a true sys.argv vector by using shlex.split. |
|
586 | arg_str is quoted as a true sys.argv vector by using shlex.split. | |
587 | This allows us to easily expand variables, glob files, quote |
|
587 | This allows us to easily expand variables, glob files, quote | |
588 | arguments, etc. |
|
588 | arguments, etc. | |
589 |
|
589 | |||
590 | Options: |
|
590 | Parameters | |
591 | -mode: default 'string'. If given as 'list', the argument string is |
|
591 | ---------- | |
592 | returned as a list (split on whitespace) instead of a string. |
|
592 | ||
|
593 | arg_str : str | |||
|
594 | The arguments to parse. | |||
593 |
|
595 | |||
594 | -list_all: put all option values in lists. Normally only options |
|
596 | opt_str : str | |
|
597 | The options specification. | |||
|
598 | ||||
|
599 | mode : str, default 'string' | |||
|
600 | If given as 'list', the argument string is returned as a list (split | |||
|
601 | on whitespace) instead of a string. | |||
|
602 | ||||
|
603 | list_all : bool, default False | |||
|
604 | Put all option values in lists. Normally only options | |||
595 | appearing more than once are put in a list. |
|
605 | appearing more than once are put in a list. | |
596 |
|
606 | |||
597 | -posix (True): whether to split the input line in POSIX mode or not, |
|
607 | posix : bool, default True | |
598 | as per the conventions outlined in the shlex module from the |
|
608 | Whether to split the input line in POSIX mode or not, as per the | |
599 | standard library.""" |
|
609 | conventions outlined in the :mod:`shlex` module from the standard | |
|
610 | library. | |||
|
611 | """ | |||
600 |
|
612 | |||
601 | # inject default options at the beginning of the input line |
|
613 | # inject default options at the beginning of the input line | |
602 | caller = sys._getframe(1).f_code.co_name |
|
614 | caller = sys._getframe(1).f_code.co_name |
@@ -51,18 +51,57 b' Inheritance diagram:' | |||||
51 | # The full license is in the file COPYING.txt, distributed with this software. |
|
51 | # The full license is in the file COPYING.txt, distributed with this software. | |
52 | #----------------------------------------------------------------------------- |
|
52 | #----------------------------------------------------------------------------- | |
53 | import argparse |
|
53 | import argparse | |
|
54 | import re | |||
54 |
|
55 | |||
55 | # Our own imports |
|
56 | # Our own imports | |
56 | from IPython.core.error import UsageError |
|
57 | from IPython.core.error import UsageError | |
|
58 | from IPython.utils.decorators import undoc | |||
57 | from IPython.utils.process import arg_split |
|
59 | from IPython.utils.process import arg_split | |
58 | from IPython.utils.text import dedent |
|
60 | from IPython.utils.text import dedent | |
59 |
|
61 | |||
|
62 | NAME_RE = re.compile(r"[a-zA-Z][a-zA-Z0-9_-]*$") | |||
|
63 | ||||
|
64 | @undoc | |||
60 | class MagicHelpFormatter(argparse.RawDescriptionHelpFormatter): |
|
65 | class MagicHelpFormatter(argparse.RawDescriptionHelpFormatter): | |
61 | """ A HelpFormatter which dedents but otherwise preserves indentation. |
|
66 | """A HelpFormatter with a couple of changes to meet our needs. | |
62 | """ |
|
67 | """ | |
|
68 | # Modified to dedent text. | |||
63 | def _fill_text(self, text, width, indent): |
|
69 | def _fill_text(self, text, width, indent): | |
64 | return argparse.RawDescriptionHelpFormatter._fill_text(self, dedent(text), width, indent) |
|
70 | return argparse.RawDescriptionHelpFormatter._fill_text(self, dedent(text), width, indent) | |
65 |
|
71 | |||
|
72 | # Modified to wrap argument placeholders in <> where necessary. | |||
|
73 | def _format_action_invocation(self, action): | |||
|
74 | if not action.option_strings: | |||
|
75 | metavar, = self._metavar_formatter(action, action.dest)(1) | |||
|
76 | return metavar | |||
|
77 | ||||
|
78 | else: | |||
|
79 | parts = [] | |||
|
80 | ||||
|
81 | # if the Optional doesn't take a value, format is: | |||
|
82 | # -s, --long | |||
|
83 | if action.nargs == 0: | |||
|
84 | parts.extend(action.option_strings) | |||
|
85 | ||||
|
86 | # if the Optional takes a value, format is: | |||
|
87 | # -s ARGS, --long ARGS | |||
|
88 | else: | |||
|
89 | default = action.dest.upper() | |||
|
90 | args_string = self._format_args(action, default) | |||
|
91 | # IPYTHON MODIFICATION: If args_string is not a plain name, wrap | |||
|
92 | # it in <> so it's valid RST. | |||
|
93 | if not NAME_RE.match(args_string): | |||
|
94 | args_string = "<%s>" % args_string | |||
|
95 | for option_string in action.option_strings: | |||
|
96 | parts.append('%s %s' % (option_string, args_string)) | |||
|
97 | ||||
|
98 | return ', '.join(parts) | |||
|
99 | ||||
|
100 | # Override the default prefix ('usage') to our % magic escape, | |||
|
101 | # in a code block. | |||
|
102 | def add_usage(self, usage, actions, groups, prefix="::\n\n %"): | |||
|
103 | super(MagicHelpFormatter, self).add_usage(usage, actions, groups, prefix) | |||
|
104 | ||||
66 | class MagicArgumentParser(argparse.ArgumentParser): |
|
105 | class MagicArgumentParser(argparse.ArgumentParser): | |
67 | """ An ArgumentParser tweaked for use by IPython magics. |
|
106 | """ An ArgumentParser tweaked for use by IPython magics. | |
68 | """ |
|
107 | """ | |
@@ -113,15 +152,8 b' def construct_parser(magic_func):' | |||||
113 | if result is not None: |
|
152 | if result is not None: | |
114 | group = result |
|
153 | group = result | |
115 |
|
154 | |||
116 | # Replace the starting 'usage: ' with IPython's %. |
|
|||
117 | help_text = parser.format_help() |
|
|||
118 | if help_text.startswith('usage: '): |
|
|||
119 | help_text = help_text.replace('usage: ', '%', 1) |
|
|||
120 | else: |
|
|||
121 | help_text = '%' + help_text |
|
|||
122 |
|
||||
123 | # Replace the magic function's docstring with the full help text. |
|
155 | # Replace the magic function's docstring with the full help text. | |
124 |
magic_func.__doc__ = |
|
156 | magic_func.__doc__ = parser.format_help() | |
125 |
|
157 | |||
126 | return parser |
|
158 | return parser | |
127 |
|
159 |
@@ -114,6 +114,7 b' class BasicMagics(Magics):' | |||||
114 | Examples |
|
114 | Examples | |
115 | -------- |
|
115 | -------- | |
116 | :: |
|
116 | :: | |
|
117 | ||||
117 | In [1]: %alias_magic t timeit |
|
118 | In [1]: %alias_magic t timeit | |
118 | Created `%t` as an alias for `%timeit`. |
|
119 | Created `%t` as an alias for `%timeit`. | |
119 | Created `%%t` as an alias for `%%timeit`. |
|
120 | Created `%%t` as an alias for `%%timeit`. |
@@ -275,7 +275,7 b' class CodeMagics(Magics):' | |||||
275 | where source can be a filename, URL, input history range or macro |
|
275 | where source can be a filename, URL, input history range or macro | |
276 |
|
276 | |||
277 | Options: |
|
277 | Options: | |
278 | -------- |
|
278 | ||
279 | -r <lines>: Specify lines or ranges of lines to load from the source. |
|
279 | -r <lines>: Specify lines or ranges of lines to load from the source. | |
280 | Ranges could be specified as x-y (x..y) or in python-style x:y |
|
280 | Ranges could be specified as x-y (x..y) or in python-style x:y | |
281 | (x..(y-1)). Both limits x and y can be left blank (meaning the |
|
281 | (x..(y-1)). Both limits x and y can be left blank (meaning the |
@@ -74,44 +74,44 b' def foo(self, args):' | |||||
74 |
|
74 | |||
75 |
|
75 | |||
76 | def test_magic_arguments(): |
|
76 | def test_magic_arguments(): | |
77 | assert_equal(magic_foo1.__doc__, '%foo1 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
77 | assert_equal(magic_foo1.__doc__, '::\n\n %foo1 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
78 | assert_equal(getattr(magic_foo1, 'argcmd_name', None), None) |
|
78 | assert_equal(getattr(magic_foo1, 'argcmd_name', None), None) | |
79 | assert_equal(real_name(magic_foo1), 'foo1') |
|
79 | assert_equal(real_name(magic_foo1), 'foo1') | |
80 | assert_equal(magic_foo1(None, ''), argparse.Namespace(foo=None)) |
|
80 | assert_equal(magic_foo1(None, ''), argparse.Namespace(foo=None)) | |
81 | assert hasattr(magic_foo1, 'has_arguments') |
|
81 | assert hasattr(magic_foo1, 'has_arguments') | |
82 |
|
82 | |||
83 | assert_equal(magic_foo2.__doc__, '%foo2\n\n A docstring.\n') |
|
83 | assert_equal(magic_foo2.__doc__, '::\n\n %foo2\n\n A docstring.\n') | |
84 | assert_equal(getattr(magic_foo2, 'argcmd_name', None), None) |
|
84 | assert_equal(getattr(magic_foo2, 'argcmd_name', None), None) | |
85 | assert_equal(real_name(magic_foo2), 'foo2') |
|
85 | assert_equal(real_name(magic_foo2), 'foo2') | |
86 | assert_equal(magic_foo2(None, ''), argparse.Namespace()) |
|
86 | assert_equal(magic_foo2(None, ''), argparse.Namespace()) | |
87 | assert hasattr(magic_foo2, 'has_arguments') |
|
87 | assert hasattr(magic_foo2, 'has_arguments') | |
88 |
|
88 | |||
89 | assert_equal(magic_foo3.__doc__, '%foo3 [-f FOO] [-b BAR] [-z BAZ]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n\nGroup:\n -b BAR, --bar BAR a grouped argument\n\nSecond Group:\n -z BAZ, --baz BAZ another grouped argument\n') |
|
89 | assert_equal(magic_foo3.__doc__, '::\n\n %foo3 [-f FOO] [-b BAR] [-z BAZ]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n\nGroup:\n -b BAR, --bar BAR a grouped argument\n\nSecond Group:\n -z BAZ, --baz BAZ another grouped argument\n') | |
90 | assert_equal(getattr(magic_foo3, 'argcmd_name', None), None) |
|
90 | assert_equal(getattr(magic_foo3, 'argcmd_name', None), None) | |
91 | assert_equal(real_name(magic_foo3), 'foo3') |
|
91 | assert_equal(real_name(magic_foo3), 'foo3') | |
92 | assert_equal(magic_foo3(None, ''), |
|
92 | assert_equal(magic_foo3(None, ''), | |
93 | argparse.Namespace(bar=None, baz=None, foo=None)) |
|
93 | argparse.Namespace(bar=None, baz=None, foo=None)) | |
94 | assert hasattr(magic_foo3, 'has_arguments') |
|
94 | assert hasattr(magic_foo3, 'has_arguments') | |
95 |
|
95 | |||
96 | assert_equal(magic_foo4.__doc__, '%foo4 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
96 | assert_equal(magic_foo4.__doc__, '::\n\n %foo4 [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
97 | assert_equal(getattr(magic_foo4, 'argcmd_name', None), None) |
|
97 | assert_equal(getattr(magic_foo4, 'argcmd_name', None), None) | |
98 | assert_equal(real_name(magic_foo4), 'foo4') |
|
98 | assert_equal(real_name(magic_foo4), 'foo4') | |
99 | assert_equal(magic_foo4(None, ''), argparse.Namespace()) |
|
99 | assert_equal(magic_foo4(None, ''), argparse.Namespace()) | |
100 | assert hasattr(magic_foo4, 'has_arguments') |
|
100 | assert hasattr(magic_foo4, 'has_arguments') | |
101 |
|
101 | |||
102 | assert_equal(magic_foo5.__doc__, '%frobnicate [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
102 | assert_equal(magic_foo5.__doc__, '::\n\n %frobnicate [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
103 | assert_equal(getattr(magic_foo5, 'argcmd_name', None), 'frobnicate') |
|
103 | assert_equal(getattr(magic_foo5, 'argcmd_name', None), 'frobnicate') | |
104 | assert_equal(real_name(magic_foo5), 'frobnicate') |
|
104 | assert_equal(real_name(magic_foo5), 'frobnicate') | |
105 | assert_equal(magic_foo5(None, ''), argparse.Namespace(foo=None)) |
|
105 | assert_equal(magic_foo5(None, ''), argparse.Namespace(foo=None)) | |
106 | assert hasattr(magic_foo5, 'has_arguments') |
|
106 | assert hasattr(magic_foo5, 'has_arguments') | |
107 |
|
107 | |||
108 | assert_equal(magic_magic_foo.__doc__, '%magic_foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
108 | assert_equal(magic_magic_foo.__doc__, '::\n\n %magic_foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
109 | assert_equal(getattr(magic_magic_foo, 'argcmd_name', None), None) |
|
109 | assert_equal(getattr(magic_magic_foo, 'argcmd_name', None), None) | |
110 | assert_equal(real_name(magic_magic_foo), 'magic_foo') |
|
110 | assert_equal(real_name(magic_magic_foo), 'magic_foo') | |
111 | assert_equal(magic_magic_foo(None, ''), argparse.Namespace(foo=None)) |
|
111 | assert_equal(magic_magic_foo(None, ''), argparse.Namespace(foo=None)) | |
112 | assert hasattr(magic_magic_foo, 'has_arguments') |
|
112 | assert hasattr(magic_magic_foo, 'has_arguments') | |
113 |
|
113 | |||
114 | assert_equal(foo.__doc__, '%foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') |
|
114 | assert_equal(foo.__doc__, '::\n\n %foo [-f FOO]\n\n A docstring.\n\noptional arguments:\n -f FOO, --foo FOO an argument\n') | |
115 | assert_equal(getattr(foo, 'argcmd_name', None), None) |
|
115 | assert_equal(getattr(foo, 'argcmd_name', None), None) | |
116 | assert_equal(real_name(foo), 'foo') |
|
116 | assert_equal(real_name(foo), 'foo') | |
117 | assert_equal(foo(None, ''), argparse.Namespace(foo=None)) |
|
117 | assert_equal(foo(None, ''), argparse.Namespace(foo=None)) |
@@ -2,7 +2,8 b'' | |||||
2 | """ |
|
2 | """ | |
3 | ultratb.py -- Spice up your tracebacks! |
|
3 | ultratb.py -- Spice up your tracebacks! | |
4 |
|
4 | |||
5 |
* |
|
5 | **ColorTB** | |
|
6 | ||||
6 | I've always found it a bit hard to visually parse tracebacks in Python. The |
|
7 | I've always found it a bit hard to visually parse tracebacks in Python. The | |
7 | ColorTB class is a solution to that problem. It colors the different parts of a |
|
8 | ColorTB class is a solution to that problem. It colors the different parts of a | |
8 | traceback in a manner similar to what you would expect from a syntax-highlighting |
|
9 | traceback in a manner similar to what you would expect from a syntax-highlighting | |
@@ -13,7 +14,8 b' Installation instructions for ColorTB::' | |||||
13 | import sys,ultratb |
|
14 | import sys,ultratb | |
14 | sys.excepthook = ultratb.ColorTB() |
|
15 | sys.excepthook = ultratb.ColorTB() | |
15 |
|
16 | |||
16 |
* |
|
17 | **VerboseTB** | |
|
18 | ||||
17 | I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds |
|
19 | I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds | |
18 | of useful info when a traceback occurs. Ping originally had it spit out HTML |
|
20 | of useful info when a traceback occurs. Ping originally had it spit out HTML | |
19 | and intended it for CGI programmers, but why should they have all the fun? I |
|
21 | and intended it for CGI programmers, but why should they have all the fun? I |
@@ -68,6 +68,7 b' from IPython.core import magic_arguments' | |||||
68 | from IPython.core.magic import Magics, magics_class, cell_magic |
|
68 | from IPython.core.magic import Magics, magics_class, cell_magic | |
69 | from IPython.utils import py3compat |
|
69 | from IPython.utils import py3compat | |
70 | from IPython.utils.path import get_ipython_cache_dir |
|
70 | from IPython.utils.path import get_ipython_cache_dir | |
|
71 | from IPython.utils.text import dedent | |||
71 |
|
72 | |||
72 | import Cython |
|
73 | import Cython | |
73 | from Cython.Compiler.Errors import CompileError |
|
74 | from Cython.Compiler.Errors import CompileError | |
@@ -331,9 +332,12 b' class CythonMagics(Magics):' | |||||
331 | return html |
|
332 | return html | |
332 |
|
333 | |||
333 | __doc__ = __doc__.format( |
|
334 | __doc__ = __doc__.format( | |
334 | CYTHON_DOC = ' '*8 + CythonMagics.cython.__doc__, |
|
335 | # rST doesn't see the -+ flag as part of an option list, so we | |
335 | CYTHON_INLINE_DOC = ' '*8 + CythonMagics.cython_inline.__doc__, |
|
336 | # hide it from the module-level docstring. | |
336 |
CYTHON_ |
|
337 | CYTHON_DOC = dedent(CythonMagics.cython.__doc__\ | |
|
338 | .replace('-+, --cplus','--cplus ')), | |||
|
339 | CYTHON_INLINE_DOC = dedent(CythonMagics.cython_inline.__doc__), | |||
|
340 | CYTHON_PYXIMPORT_DOC = dedent(CythonMagics.cython_pyximport.__doc__), | |||
337 | ) |
|
341 | ) | |
338 |
|
342 | |||
339 | def load_ipython_extension(ip): |
|
343 | def load_ipython_extension(ip): |
@@ -55,6 +55,7 b' from IPython.core.magic_arguments import (' | |||||
55 | argument, magic_arguments, parse_argstring |
|
55 | argument, magic_arguments, parse_argstring | |
56 | ) |
|
56 | ) | |
57 | from IPython.utils.py3compat import unicode_to_str |
|
57 | from IPython.utils.py3compat import unicode_to_str | |
|
58 | from IPython.utils.text import dedent | |||
58 |
|
59 | |||
59 | class OctaveMagicError(oct2py.Oct2PyError): |
|
60 | class OctaveMagicError(oct2py.Oct2PyError): | |
60 | pass |
|
61 | pass | |
@@ -145,6 +146,8 b' class OctaveMagics(Magics):' | |||||
145 | ''' |
|
146 | ''' | |
146 | Line-level magic that pulls a variable from Octave. |
|
147 | Line-level magic that pulls a variable from Octave. | |
147 |
|
148 | |||
|
149 | :: | |||
|
150 | ||||
148 | In [18]: _ = %octave x = [1 2; 3 4]; y = 'hello' |
|
151 | In [18]: _ = %octave x = [1 2; 3 4]; y = 'hello' | |
149 |
|
152 | |||
150 | In [19]: %octave_pull x y |
|
153 | In [19]: %octave_pull x y | |
@@ -195,7 +198,7 b' class OctaveMagics(Magics):' | |||||
195 | def octave(self, line, cell=None, local_ns=None): |
|
198 | def octave(self, line, cell=None, local_ns=None): | |
196 | ''' |
|
199 | ''' | |
197 | Execute code in Octave, and pull some of the results back into the |
|
200 | Execute code in Octave, and pull some of the results back into the | |
198 |
Python namespace |
|
201 | Python namespace:: | |
199 |
|
202 | |||
200 | In [9]: %octave X = [1 2; 3 4]; mean(X) |
|
203 | In [9]: %octave X = [1 2; 3 4]; mean(X) | |
201 | Out[9]: array([[ 2., 3.]]) |
|
204 | Out[9]: array([[ 2., 3.]]) | |
@@ -209,7 +212,7 b' class OctaveMagics(Magics):' | |||||
209 |
|
212 | |||
210 | -2*x^4 - 1*x^3 + 0*x^2 + 1*x^1 + 2 |
|
213 | -2*x^4 - 1*x^3 + 0*x^2 + 1*x^1 + 2 | |
211 |
|
214 | |||
212 | In the notebook, plots are published as the output of the cell, e.g. |
|
215 | In the notebook, plots are published as the output of the cell, e.g.:: | |
213 |
|
216 | |||
214 | %octave plot([1 2 3], [4 5 6]) |
|
217 | %octave plot([1 2 3], [4 5 6]) | |
215 |
|
218 | |||
@@ -360,9 +363,9 b' class OctaveMagics(Magics):' | |||||
360 |
|
363 | |||
361 |
|
364 | |||
362 | __doc__ = __doc__.format( |
|
365 | __doc__ = __doc__.format( | |
363 |
OCTAVE_DOC = |
|
366 | OCTAVE_DOC = dedent(OctaveMagics.octave.__doc__), | |
364 |
OCTAVE_PUSH_DOC = |
|
367 | OCTAVE_PUSH_DOC = dedent(OctaveMagics.octave_push.__doc__), | |
365 |
OCTAVE_PULL_DOC = |
|
368 | OCTAVE_PULL_DOC = dedent(OctaveMagics.octave_pull.__doc__) | |
366 | ) |
|
369 | ) | |
367 |
|
370 | |||
368 |
|
371 |
@@ -75,6 +75,7 b' from IPython.core.magic_arguments import (' | |||||
75 | from IPython.external.simplegeneric import generic |
|
75 | from IPython.external.simplegeneric import generic | |
76 | from IPython.utils.py3compat import (str_to_unicode, unicode_to_str, PY3, |
|
76 | from IPython.utils.py3compat import (str_to_unicode, unicode_to_str, PY3, | |
77 | unicode_type) |
|
77 | unicode_type) | |
|
78 | from IPython.utils.text import dedent | |||
78 |
|
79 | |||
79 | class RInterpreterError(ri.RRuntimeError): |
|
80 | class RInterpreterError(ri.RRuntimeError): | |
80 | """An error when running R code in a %%R magic cell.""" |
|
81 | """An error when running R code in a %%R magic cell.""" | |
@@ -679,10 +680,10 b' class RMagics(Magics):' | |||||
679 | return self.Rconverter(result, dataframe=False) |
|
680 | return self.Rconverter(result, dataframe=False) | |
680 |
|
681 | |||
681 | __doc__ = __doc__.format( |
|
682 | __doc__ = __doc__.format( | |
682 |
R_DOC = |
|
683 | R_DOC = dedent(RMagics.R.__doc__), | |
683 |
RPUSH_DOC = |
|
684 | RPUSH_DOC = dedent(RMagics.Rpush.__doc__), | |
684 |
RPULL_DOC = |
|
685 | RPULL_DOC = dedent(RMagics.Rpull.__doc__), | |
685 |
RGET_DOC = |
|
686 | RGET_DOC = dedent(RMagics.Rget.__doc__) | |
686 | ) |
|
687 | ) | |
687 |
|
688 | |||
688 |
|
689 |
@@ -145,9 +145,11 b' class NotebookHandler(IPythonHandler):' | |||||
145 |
|
145 | |||
146 | POST creates new notebooks. The server always decides on the notebook name. |
|
146 | POST creates new notebooks. The server always decides on the notebook name. | |
147 |
|
147 | |||
148 |
POST /api/notebooks/path |
|
148 | POST /api/notebooks/path | |
149 | If content specified, upload a notebook, otherwise start empty. |
|
149 | New untitled notebook in path. If content specified, upload a | |
150 | POST /api/notebooks/path?copy=OtherNotebook.ipynb : new copy of OtherNotebook in path |
|
150 | notebook, otherwise start empty. | |
|
151 | POST /api/notebooks/path?copy=OtherNotebook.ipynb | |||
|
152 | New copy of OtherNotebook in path | |||
151 | """ |
|
153 | """ | |
152 |
|
154 | |||
153 | if name is not None: |
|
155 | if name is not None: | |
@@ -171,14 +173,15 b' class NotebookHandler(IPythonHandler):' | |||||
171 | def put(self, path='', name=None): |
|
173 | def put(self, path='', name=None): | |
172 | """Saves the notebook in the location specified by name and path. |
|
174 | """Saves the notebook in the location specified by name and path. | |
173 |
|
175 | |||
174 | PUT /api/notebooks/path/Name.ipynb : Save notebook at path/Name.ipynb |
|
176 | PUT is very similar to POST, but the requester specifies the name, | |
175 | Notebook structure is specified in `content` key of JSON request body. |
|
177 | whereas with POST, the server picks the name. | |
176 | If content is not specified, create a new empty notebook. |
|
|||
177 | PUT /api/notebooks/path/Name.ipynb?copy=OtherNotebook.ipynb : copy OtherNotebook to Name |
|
|||
178 |
|
178 | |||
179 | POST and PUT are basically the same. The only difference: |
|
179 | PUT /api/notebooks/path/Name.ipynb | |
180 |
|
180 | Save notebook at ``path/Name.ipynb``. Notebook structure is specified | ||
181 | - with POST, server always picks the name, with PUT the requester does |
|
181 | in `content` key of JSON request body. If content is not specified, | |
|
182 | create a new empty notebook. | |||
|
183 | PUT /api/notebooks/path/Name.ipynb?copy=OtherNotebook.ipynb | |||
|
184 | Copy OtherNotebook to Name | |||
182 | """ |
|
185 | """ | |
183 | if name is None: |
|
186 | if name is None: | |
184 | raise web.HTTPError(400, "Only PUT to full names. Use POST for directories.") |
|
187 | raise web.HTTPError(400, "Only PUT to full names. Use POST for directories.") |
@@ -133,9 +133,9 b' class ZMQSocketChannel(Thread):' | |||||
133 | def stop(self): |
|
133 | def stop(self): | |
134 | """Stop the channel's event loop and join its thread. |
|
134 | """Stop the channel's event loop and join its thread. | |
135 |
|
135 | |||
136 |
This calls :meth |
|
136 | This calls :meth:`~threading.Thread.join` and returns when the thread | |
137 | terminates. :class:`RuntimeError` will be raised if |
|
137 | terminates. :class:`RuntimeError` will be raised if | |
138 |
:meth |
|
138 | :meth:`~threading.Thread.start` is called again. | |
139 | """ |
|
139 | """ | |
140 | self.join() |
|
140 | self.join() | |
141 |
|
141 | |||
@@ -430,7 +430,7 b' class IOPubChannel(ZMQSocketChannel):' | |||||
430 | def flush(self, timeout=1.0): |
|
430 | def flush(self, timeout=1.0): | |
431 | """Immediately processes all pending messages on the iopub channel. |
|
431 | """Immediately processes all pending messages on the iopub channel. | |
432 |
|
432 | |||
433 |
Callers should use this method to ensure that :meth |
|
433 | Callers should use this method to ensure that :meth:`call_handlers` | |
434 | has been called for all messages that have been received on the |
|
434 | has been called for all messages that have been received on the | |
435 | 0MQ SUB socket of this channel. |
|
435 | 0MQ SUB socket of this channel. | |
436 |
|
436 |
@@ -102,7 +102,7 b' class KernelClient(LoggingConfigurable, ConnectionFileMixin):' | |||||
102 | This will create the channels if they do not exist and then start |
|
102 | This will create the channels if they do not exist and then start | |
103 | them (their activity runs in a thread). If port numbers of 0 are |
|
103 | them (their activity runs in a thread). If port numbers of 0 are | |
104 | being used (random ports) then you must first call |
|
104 | being used (random ports) then you must first call | |
105 |
:meth |
|
105 | :meth:`start_kernel`. If the channels have been stopped and you | |
106 | call this, :class:`RuntimeError` will be raised. |
|
106 | call this, :class:`RuntimeError` will be raised. | |
107 | """ |
|
107 | """ | |
108 | if shell: |
|
108 | if shell: |
@@ -185,8 +185,8 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
185 | If random ports (port=0) are being used, this method must be called |
|
185 | If random ports (port=0) are being used, this method must be called | |
186 | before the channels are created. |
|
186 | before the channels are created. | |
187 |
|
187 | |||
188 |
Parameters |
|
188 | Parameters | |
189 |
---------- |
|
189 | ---------- | |
190 | **kw : optional |
|
190 | **kw : optional | |
191 | keyword arguments that are passed down to build the kernel_cmd |
|
191 | keyword arguments that are passed down to build the kernel_cmd | |
192 | and launching the kernel (e.g. Popen kwargs). |
|
192 | and launching the kernel (e.g. Popen kwargs). | |
@@ -227,8 +227,8 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
227 | 2. If that fails, the kernel is shutdown forcibly by sending it |
|
227 | 2. If that fails, the kernel is shutdown forcibly by sending it | |
228 | a signal. |
|
228 | a signal. | |
229 |
|
229 | |||
230 |
Parameters |
|
230 | Parameters | |
231 |
---------- |
|
231 | ---------- | |
232 | now : bool |
|
232 | now : bool | |
233 | Should the kernel be forcible killed *now*. This skips the |
|
233 | Should the kernel be forcible killed *now*. This skips the | |
234 | first, nice shutdown attempt. |
|
234 | first, nice shutdown attempt. |
@@ -48,8 +48,8 b' class ParentPollerWindows(Thread):' | |||||
48 | """ Create the poller. At least one of the optional parameters must be |
|
48 | """ Create the poller. At least one of the optional parameters must be | |
49 | provided. |
|
49 | provided. | |
50 |
|
50 | |||
51 |
Parameters |
|
51 | Parameters | |
52 |
---------- |
|
52 | ---------- | |
53 | interrupt_handle : HANDLE (int), optional |
|
53 | interrupt_handle : HANDLE (int), optional | |
54 | If provided, the program will generate a Ctrl+C event when this |
|
54 | If provided, the program will generate a Ctrl+C event when this | |
55 | handle is signaled. |
|
55 | handle is signaled. |
@@ -527,11 +527,13 b' class Session(Configurable):' | |||||
527 | Returns |
|
527 | Returns | |
528 | ------- |
|
528 | ------- | |
529 | msg_list : list |
|
529 | msg_list : list | |
530 | The list of bytes objects to be sent with the format: |
|
530 | The list of bytes objects to be sent with the format:: | |
531 | [ident1,ident2,...,DELIM,HMAC,p_header,p_parent,p_metadata,p_content, |
|
531 | ||
532 | buffer1,buffer2,...]. In this list, the p_* entities are |
|
532 | [ident1, ident2, ..., DELIM, HMAC, p_header, p_parent, | |
533 | the packed or serialized versions, so if JSON is used, these |
|
533 | p_metadata, p_content, buffer1, buffer2, ...] | |
534 | are utf8 encoded JSON strings. |
|
534 | ||
|
535 | In this list, the ``p_*`` entities are the packed or serialized | |||
|
536 | versions, so if JSON is used, these are utf8 encoded JSON strings. | |||
535 | """ |
|
537 | """ | |
536 | content = msg.get('content', {}) |
|
538 | content = msg.get('content', {}) | |
537 | if content is None: |
|
539 | if content is None: | |
@@ -781,8 +783,8 b' class Session(Configurable):' | |||||
781 | methods work with full message lists, whereas pack/unpack work with |
|
783 | methods work with full message lists, whereas pack/unpack work with | |
782 | the individual message parts in the message list. |
|
784 | the individual message parts in the message list. | |
783 |
|
785 | |||
784 |
Parameters |
|
786 | Parameters | |
785 |
---------- |
|
787 | ---------- | |
786 | msg_list : list of bytes or Message objects |
|
788 | msg_list : list of bytes or Message objects | |
787 | The list of message parts of the form [HMAC,p_header,p_parent, |
|
789 | The list of message parts of the form [HMAC,p_header,p_parent, | |
788 | p_metadata,p_content,buffer1,buffer2,...]. |
|
790 | p_metadata,p_content,buffer1,buffer2,...]. |
@@ -197,31 +197,26 b' class KernelMagics(Magics):' | |||||
197 | temporary file and will execute the contents of this file when you |
|
197 | temporary file and will execute the contents of this file when you | |
198 | close it (don't forget to save it!). |
|
198 | close it (don't forget to save it!). | |
199 |
|
199 | |||
200 |
|
||||
201 | Options: |
|
200 | Options: | |
202 |
|
201 | |||
203 | -n <number>: open the editor at a specified line number. By default, |
|
202 | -n <number> | |
204 | the IPython editor hook uses the unix syntax 'editor +N filename', but |
|
203 | Open the editor at a specified line number. By default, the IPython | |
205 | you can configure this by providing your own modified hook if your |
|
204 | editor hook uses the unix syntax 'editor +N filename', but you can | |
206 | favorite editor supports line-number specifications with a different |
|
205 | configure this by providing your own modified hook if your favorite | |
207 | syntax. |
|
206 | editor supports line-number specifications with a different syntax. | |
208 |
|
207 | |||
209 | -p: this will call the editor with the same data as the previous time |
|
208 | -p | |
210 | it was used, regardless of how long ago (in your current session) it |
|
209 | Call the editor with the same data as the previous time it was used, | |
211 | was. |
|
210 | regardless of how long ago (in your current session) it was. | |
212 |
|
211 | |||
213 | -r: use 'raw' input. This option only applies to input taken from the |
|
212 | -r | |
|
213 | Use 'raw' input. This option only applies to input taken from the | |||
214 | user's history. By default, the 'processed' history is used, so that |
|
214 | user's history. By default, the 'processed' history is used, so that | |
215 | magics are loaded in their transformed version to valid Python. If |
|
215 | magics are loaded in their transformed version to valid Python. If | |
216 | this option is given, the raw input as typed as the command line is |
|
216 | this option is given, the raw input as typed as the command line is | |
217 | used instead. When you exit the editor, it will be executed by |
|
217 | used instead. When you exit the editor, it will be executed by | |
218 | IPython's own processor. |
|
218 | IPython's own processor. | |
219 |
|
219 | |||
220 | -x: do not execute the edited code immediately upon exit. This is |
|
|||
221 | mainly useful if you are editing programs which need to be called with |
|
|||
222 | command line arguments, which you can then do using %run. |
|
|||
223 |
|
||||
224 |
|
||||
225 | Arguments: |
|
220 | Arguments: | |
226 |
|
221 | |||
227 | If arguments are given, the following possibilites exist: |
|
222 | If arguments are given, the following possibilites exist: | |
@@ -237,7 +232,7 b' class KernelMagics(Magics):' | |||||
237 |
|
232 | |||
238 | - If the argument is the name of an object (other than a string), |
|
233 | - If the argument is the name of an object (other than a string), | |
239 | IPython will try to locate the file where it was defined and open the |
|
234 | IPython will try to locate the file where it was defined and open the | |
240 | editor at the point where it is defined. You can use `%edit function` |
|
235 | editor at the point where it is defined. You can use ``%edit function`` | |
241 | to load an editor exactly at the point where 'function' is defined, |
|
236 | to load an editor exactly at the point where 'function' is defined, | |
242 | edit it and have the file be executed automatically. |
|
237 | edit it and have the file be executed automatically. | |
243 |
|
238 | |||
@@ -255,58 +250,11 b' class KernelMagics(Magics):' | |||||
255 | editor. It will execute its contents with execfile() when you exit, |
|
250 | editor. It will execute its contents with execfile() when you exit, | |
256 | loading any code in the file into your interactive namespace. |
|
251 | loading any code in the file into your interactive namespace. | |
257 |
|
252 | |||
258 | After executing your code, %edit will return as output the code you |
|
253 | Unlike in the terminal, this is designed to use a GUI editor, and we do | |
259 | typed in the editor (except when it was an existing file). This way |
|
254 | not know when it has closed. So the file you edit will not be | |
260 | you can reload the code in further invocations of %edit as a variable, |
|
255 | automatically executed or printed. | |
261 | via _<NUMBER> or Out[<NUMBER>], where <NUMBER> is the prompt number of |
|
|||
262 | the output. |
|
|||
263 |
|
256 | |||
264 | Note that %edit is also available through the alias %ed. |
|
257 | Note that %edit is also available through the alias %ed. | |
265 |
|
||||
266 | This is an example of creating a simple function inside the editor and |
|
|||
267 | then modifying it. First, start up the editor: |
|
|||
268 |
|
||||
269 | In [1]: ed |
|
|||
270 | Editing... done. Executing edited code... |
|
|||
271 | Out[1]: 'def foo():n print "foo() was defined in an editing session"n' |
|
|||
272 |
|
||||
273 | We can then call the function foo(): |
|
|||
274 |
|
||||
275 | In [2]: foo() |
|
|||
276 | foo() was defined in an editing session |
|
|||
277 |
|
||||
278 | Now we edit foo. IPython automatically loads the editor with the |
|
|||
279 | (temporary) file where foo() was previously defined: |
|
|||
280 |
|
||||
281 | In [3]: ed foo |
|
|||
282 | Editing... done. Executing edited code... |
|
|||
283 |
|
||||
284 | And if we call foo() again we get the modified version: |
|
|||
285 |
|
||||
286 | In [4]: foo() |
|
|||
287 | foo() has now been changed! |
|
|||
288 |
|
||||
289 | Here is an example of how to edit a code snippet successive |
|
|||
290 | times. First we call the editor: |
|
|||
291 |
|
||||
292 | In [5]: ed |
|
|||
293 | Editing... done. Executing edited code... |
|
|||
294 | hello |
|
|||
295 | Out[5]: "print 'hello'n" |
|
|||
296 |
|
||||
297 | Now we call it again with the previous output (stored in _): |
|
|||
298 |
|
||||
299 | In [6]: ed _ |
|
|||
300 | Editing... done. Executing edited code... |
|
|||
301 | hello world |
|
|||
302 | Out[6]: "print 'hello world'n" |
|
|||
303 |
|
||||
304 | Now we call it with the output #8 (stored in _8, also as Out[8]): |
|
|||
305 |
|
||||
306 | In [7]: ed _8 |
|
|||
307 | Editing... done. Executing edited code... |
|
|||
308 | hello again |
|
|||
309 | Out[7]: "print 'hello again'n" |
|
|||
310 | """ |
|
258 | """ | |
311 |
|
259 | |||
312 | opts,args = self.parse_options(parameter_s,'prn:') |
|
260 | opts,args = self.parse_options(parameter_s,'prn:') |
@@ -366,7 +366,8 b' class BackgroundJobBase(threading.Thread):' | |||||
366 | - A strform attribute used in calls to __str__. |
|
366 | - A strform attribute used in calls to __str__. | |
367 |
|
367 | |||
368 | - A call() method, which will make the actual execution call and must |
|
368 | - A call() method, which will make the actual execution call and must | |
369 |
return a value to be held in the 'result' field of the job object. |
|
369 | return a value to be held in the 'result' field of the job object. | |
|
370 | """ | |||
370 |
|
371 | |||
371 | # Class constants for status, in string and as numerical codes (when |
|
372 | # Class constants for status, in string and as numerical codes (when | |
372 | # updating jobs lists, we don't want to do string comparisons). This will |
|
373 | # updating jobs lists, we don't want to do string comparisons). This will | |
@@ -378,6 +379,10 b' class BackgroundJobBase(threading.Thread):' | |||||
378 | stat_dead_c = -1 |
|
379 | stat_dead_c = -1 | |
379 |
|
380 | |||
380 | def __init__(self): |
|
381 | def __init__(self): | |
|
382 | """Must be implemented in subclasses. | |||
|
383 | ||||
|
384 | Subclasses must call :meth:`_init` for standard initialisation. | |||
|
385 | """ | |||
381 | raise NotImplementedError("This class can not be instantiated directly.") |
|
386 | raise NotImplementedError("This class can not be instantiated directly.") | |
382 |
|
387 | |||
383 | def _init(self): |
|
388 | def _init(self): |
@@ -49,6 +49,7 b' class Audio(DisplayObject):' | |||||
49 |
|
49 | |||
50 | Examples |
|
50 | Examples | |
51 | -------- |
|
51 | -------- | |
|
52 | :: | |||
52 |
|
53 | |||
53 | # Generate a sound |
|
54 | # Generate a sound | |
54 | import numpy as np |
|
55 | import numpy as np | |
@@ -57,13 +58,13 b' class Audio(DisplayObject):' | |||||
57 | data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t)) |
|
58 | data = np.sin(2*np.pi*220*t) + np.sin(2*np.pi*224*t)) | |
58 | Audio(data,rate=framerate) |
|
59 | Audio(data,rate=framerate) | |
59 |
|
60 | |||
60 | Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") |
|
61 | Audio("http://www.nch.com.au/acm/8k16bitpcm.wav") # From URL | |
61 | Audio(url="http://www.w3schools.com/html/horse.ogg") |
|
62 | Audio(url="http://www.w3schools.com/html/horse.ogg") | |
62 |
|
63 | |||
63 | Audio('/path/to/sound.wav') |
|
64 | Audio('/path/to/sound.wav') # From file | |
64 | Audio(filename='/path/to/sound.ogg') |
|
65 | Audio(filename='/path/to/sound.ogg') | |
65 |
|
66 | |||
66 | Audio(b'RAW_WAV_DATA..) |
|
67 | Audio(b'RAW_WAV_DATA..) # From bytes | |
67 | Audio(data=b'RAW_WAV_DATA..) |
|
68 | Audio(data=b'RAW_WAV_DATA..) | |
68 |
|
69 | |||
69 | """ |
|
70 | """ | |
@@ -198,21 +199,20 b' class IFrame(object):' | |||||
198 | class YouTubeVideo(IFrame): |
|
199 | class YouTubeVideo(IFrame): | |
199 | """Class for embedding a YouTube Video in an IPython session, based on its video id. |
|
200 | """Class for embedding a YouTube Video in an IPython session, based on its video id. | |
200 |
|
201 | |||
201 | e.g. to embed the video on this page: |
|
202 | e.g. to embed the video from http://www.youtube.com/watch?v=foo , you would | |
202 |
|
203 | do:: | ||
203 | http://www.youtube.com/watch?v=foo |
|
|||
204 |
|
||||
205 | you would do: |
|
|||
206 |
|
204 | |||
207 | vid = YouTubeVideo("foo") |
|
205 | vid = YouTubeVideo("foo") | |
208 | display(vid) |
|
206 | display(vid) | |
209 |
|
207 | |||
210 | To start from 30 seconds: |
|
208 | To start from 30 seconds:: | |
211 |
|
209 | |||
212 | vid = YouTubeVideo("abc", start=30) |
|
210 | vid = YouTubeVideo("abc", start=30) | |
213 | display(vid) |
|
211 | display(vid) | |
214 |
|
212 | |||
215 |
To calculate seconds from time as hours, minutes, seconds use |
|
213 | To calculate seconds from time as hours, minutes, seconds use | |
|
214 | :class:`datetime.timedelta`:: | |||
|
215 | ||||
216 | start=int(timedelta(hours=1, minutes=46, seconds=40).total_seconds()) |
|
216 | start=int(timedelta(hours=1, minutes=46, seconds=40).total_seconds()) | |
217 |
|
217 | |||
218 | Other parameters can be provided as documented at |
|
218 | Other parameters can be provided as documented at | |
@@ -316,17 +316,15 b' class FileLink(object):' | |||||
316 | class FileLinks(FileLink): |
|
316 | class FileLinks(FileLink): | |
317 | """Class for embedding local file links in an IPython session, based on path |
|
317 | """Class for embedding local file links in an IPython session, based on path | |
318 |
|
318 | |||
319 |
e.g. to embed links to files that were generated in the IPython notebook |
|
319 | e.g. to embed links to files that were generated in the IPython notebook | |
320 |
|
320 | under ``my/data``, you would do:: | ||
321 | you would do: |
|
|||
322 |
|
321 | |||
323 | local_files = FileLinks("my/data") |
|
322 | local_files = FileLinks("my/data") | |
324 | display(local_files) |
|
323 | display(local_files) | |
325 |
|
324 | |||
326 | or in the HTML notebook, just |
|
325 | or in the HTML notebook, just:: | |
327 |
|
326 | |||
328 | FileLinks("my/data") |
|
327 | FileLinks("my/data") | |
329 |
|
||||
330 | """ |
|
328 | """ | |
331 | def __init__(self, |
|
329 | def __init__(self, | |
332 | path, |
|
330 | path, | |
@@ -337,35 +335,38 b' class FileLinks(FileLink):' | |||||
337 | notebook_display_formatter=None, |
|
335 | notebook_display_formatter=None, | |
338 | terminal_display_formatter=None): |
|
336 | terminal_display_formatter=None): | |
339 | """ |
|
337 | """ | |
340 | included_suffixes : list of filename suffixes to include when |
|
338 | See :class:`FileLink` for the ``path``, ``url_prefix``, | |
341 | formatting output [default: include all files] |
|
339 | ``result_html_prefix`` and ``result_html_suffix`` parameters. | |
342 |
|
340 | |||
343 | See the FileLink (baseclass of LocalDirectory) docstring for |
|
341 | included_suffixes : list | |
344 | information on additional parameters. |
|
342 | Filename suffixes to include when formatting output [default: include | |
|
343 | all files] | |||
345 |
|
344 | |||
346 |
|
|
345 | notebook_display_formatter : function | |
347 |
in the notebook. See discussion of |
|
346 | Used to format links for display in the notebook. See discussion of | |
|
347 | formatter functions below. | |||
348 |
|
348 | |||
349 |
|
|
349 | terminal_display_formatter : function | |
350 |
in the terminal. See discussion of |
|
350 | Used to format links for display in the terminal. See discussion of | |
|
351 | formatter functions below. | |||
351 |
|
352 | |||
|
353 | Formatter functions must be of the form:: | |||
352 |
|
354 | |||
353 | Passing custom formatter functions |
|
|||
354 | ---------------------------------- |
|
|||
355 | Formatter functions must be of the form: |
|
|||
356 |
|
|
355 | f(dirname, fnames, included_suffixes) | |
357 | dirname : the name of a directory (a string), |
|
356 | ||
358 | fnames : a list of the files in that directory |
|
357 | dirname : str | |
359 | included_suffixes : a list of the file suffixes that should be |
|
358 | The name of a directory | |
360 | included in the output (passing None means |
|
359 | fnames : list | |
361 | to include all suffixes in the output in |
|
360 | The files in that directory | |
362 | the built-in formatters) |
|
361 | included_suffixes : list | |
363 |
|
362 | The file suffixes that should be included in the output (passing None | ||
364 | returns a list of lines that should will be print in the |
|
363 | meansto include all suffixes in the output in the built-in formatters) | |
365 | notebook (if passing notebook_display_formatter) or the terminal |
|
364 | ||
366 | (if passing terminal_display_formatter). This function is iterated |
|
365 | The function should return a list of lines that will be printed in the | |
367 | over for each directory in self.path. Default formatters are in |
|
366 | notebook (if passing notebook_display_formatter) or the terminal (if | |
368 | place, can be passed here to support alternative formatting. |
|
367 | passing terminal_display_formatter). This function is iterated over for | |
|
368 | each directory in self.path. Default formatters are in place, can be | |||
|
369 | passed here to support alternative formatting. | |||
369 |
|
370 | |||
370 | """ |
|
371 | """ | |
371 | if isfile(path): |
|
372 | if isfile(path): |
@@ -49,8 +49,8 b" def passwd(passphrase=None, algorithm='sha1'):" | |||||
49 |
|
49 | |||
50 | Examples |
|
50 | Examples | |
51 | -------- |
|
51 | -------- | |
52 |
|
|
52 | >>> passwd('mypassword') | |
53 |
|
|
53 | 'sha1:7cf3:b7d6da294ea9592a9480c8f52e63cd42cfb9dd12' | |
54 |
|
54 | |||
55 | """ |
|
55 | """ | |
56 | if passphrase is None: |
|
56 | if passphrase is None: | |
@@ -89,16 +89,14 b' def passwd_check(hashed_passphrase, passphrase):' | |||||
89 |
|
89 | |||
90 | Examples |
|
90 | Examples | |
91 | -------- |
|
91 | -------- | |
92 |
|
|
92 | >>> from IPython.lib.security import passwd_check | |
93 |
|
93 | >>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a', | ||
94 | In [2]: passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a', |
|
94 | ... 'mypassword') | |
95 | ...: 'mypassword') |
|
95 | True | |
96 | Out[2]: True |
|
96 | ||
97 |
|
97 | >>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a', | ||
98 | In [3]: passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a', |
|
98 | ... 'anotherpassword') | |
99 | ...: 'anotherpassword') |
|
99 | False | |
100 | Out[3]: False |
|
|||
101 |
|
||||
102 | """ |
|
100 | """ | |
103 | try: |
|
101 | try: | |
104 | algorithm, salt, pw_digest = hashed_passphrase.split(':', 2) |
|
102 | algorithm, salt, pw_digest = hashed_passphrase.split(':', 2) |
@@ -16,7 +16,7 b' Module containing single call export functions.' | |||||
16 | from functools import wraps |
|
16 | from functools import wraps | |
17 |
|
17 | |||
18 | from IPython.nbformat.v3.nbbase import NotebookNode |
|
18 | from IPython.nbformat.v3.nbbase import NotebookNode | |
19 |
from IPython. |
|
19 | from IPython.utils.decorators import undoc | |
20 | from IPython.utils.py3compat import string_types |
|
20 | from IPython.utils.py3compat import string_types | |
21 |
|
21 | |||
22 | from .exporter import Exporter |
|
22 | from .exporter import Exporter | |
@@ -32,18 +32,20 b' from .rst import RSTExporter' | |||||
32 | # Classes |
|
32 | # Classes | |
33 | #----------------------------------------------------------------------------- |
|
33 | #----------------------------------------------------------------------------- | |
34 |
|
34 | |||
|
35 | @undoc | |||
35 | def DocDecorator(f): |
|
36 | def DocDecorator(f): | |
36 |
|
37 | |||
37 | #Set docstring of function |
|
38 | #Set docstring of function | |
38 | f.__doc__ = f.__doc__ + """ |
|
39 | f.__doc__ = f.__doc__ + """ | |
39 |
nb : Notebook |
|
40 | nb : :class:`~{nbnode_mod}.NotebookNode` | |
|
41 | The notebook to export. | |||
40 | config : config (optional, keyword arg) |
|
42 | config : config (optional, keyword arg) | |
41 | User configuration instance. |
|
43 | User configuration instance. | |
42 | resources : dict (optional, keyword arg) |
|
44 | resources : dict (optional, keyword arg) | |
43 | Resources used in the conversion process. |
|
45 | Resources used in the conversion process. | |
44 |
|
46 | |||
45 | Returns |
|
47 | Returns | |
46 |
------- |
|
48 | ------- | |
47 | tuple- output, resources, exporter_instance |
|
49 | tuple- output, resources, exporter_instance | |
48 | output : str |
|
50 | output : str | |
49 | Jinja 2 output. This is the resulting converted notebook. |
|
51 | Jinja 2 output. This is the resulting converted notebook. | |
@@ -55,8 +57,10 b' def DocDecorator(f):' | |||||
55 | to caller because it provides a 'file_extension' property which |
|
57 | to caller because it provides a 'file_extension' property which | |
56 | specifies what extension the output should be saved as. |
|
58 | specifies what extension the output should be saved as. | |
57 |
|
59 | |||
|
60 | Notes | |||
|
61 | ----- | |||
58 | WARNING: API WILL CHANGE IN FUTURE RELEASES OF NBCONVERT |
|
62 | WARNING: API WILL CHANGE IN FUTURE RELEASES OF NBCONVERT | |
59 | """ |
|
63 | """.format(nbnode_mod=NotebookNode.__module__) | |
60 |
|
64 | |||
61 | @wraps(f) |
|
65 | @wraps(f) | |
62 | def decorator(*args, **kwargs): |
|
66 | def decorator(*args, **kwargs): | |
@@ -92,10 +96,12 b' def export(exporter, nb, **kw):' | |||||
92 | """ |
|
96 | """ | |
93 | Export a notebook object using specific exporter class. |
|
97 | Export a notebook object using specific exporter class. | |
94 |
|
98 | |||
95 | exporter : Exporter class type or instance |
|
99 | Parameters | |
|
100 | ---------- | |||
|
101 | exporter : class:`~IPython.nbconvert.exporters.exporter.Exporter` class or instance | |||
96 |
|
|
102 | Class type or instance of the exporter that should be used. If the | |
97 |
|
|
103 | method initializes it's own instance of the class, it is ASSUMED that | |
98 |
|
|
104 | the class type provided exposes a constructor (``__init__``) with the same | |
99 |
|
|
105 | signature as the base Exporter class. | |
100 | """ |
|
106 | """ | |
101 |
|
107 | |||
@@ -152,6 +158,8 b' def export_by_name(format_name, nb, **kw):' | |||||
152 | (Inspect) is used to find the template's corresponding explicit export |
|
158 | (Inspect) is used to find the template's corresponding explicit export | |
153 | method defined in this module. That method is then called directly. |
|
159 | method defined in this module. That method is then called directly. | |
154 |
|
160 | |||
|
161 | Parameters | |||
|
162 | ---------- | |||
155 | format_name : str |
|
163 | format_name : str | |
156 | Name of the template style to export to. |
|
164 | Name of the template style to export to. | |
157 | """ |
|
165 | """ |
@@ -32,9 +32,6 b' from IPython.utils.traitlets import MetaHasTraits, Unicode, List' | |||||
32 | from IPython.utils.importstring import import_item |
|
32 | from IPython.utils.importstring import import_item | |
33 | from IPython.utils import text, py3compat |
|
33 | from IPython.utils import text, py3compat | |
34 |
|
34 | |||
35 | from IPython.nbconvert import preprocessors as nbpreprocessors |
|
|||
36 |
|
||||
37 |
|
||||
38 | #----------------------------------------------------------------------------- |
|
35 | #----------------------------------------------------------------------------- | |
39 | # Class |
|
36 | # Class | |
40 | #----------------------------------------------------------------------------- |
|
37 | #----------------------------------------------------------------------------- | |
@@ -96,17 +93,20 b' class Exporter(LoggingConfigurable):' | |||||
96 | def default_config(self): |
|
93 | def default_config(self): | |
97 | return Config() |
|
94 | return Config() | |
98 |
|
95 | |||
99 |
|
96 | @nbformat.docstring_nbformat_mod | ||
100 | def from_notebook_node(self, nb, resources=None, **kw): |
|
97 | def from_notebook_node(self, nb, resources=None, **kw): | |
101 | """ |
|
98 | """ | |
102 | Convert a notebook from a notebook node instance. |
|
99 | Convert a notebook from a notebook node instance. | |
103 |
|
100 | |||
104 | Parameters |
|
101 | Parameters | |
105 | ---------- |
|
102 | ---------- | |
106 | nb : Notebook node |
|
103 | nb : :class:`~{nbformat_mod}.nbbase.NotebookNode` | |
107 | resources : dict (**kw) |
|
104 | Notebook node | |
108 | of additional resources that can be accessed read/write by |
|
105 | resources : dict | |
109 | preprocessors. |
|
106 | Additional resources that can be accessed read/write by | |
|
107 | preprocessors and filters. | |||
|
108 | **kw | |||
|
109 | Ignored (?) | |||
110 | """ |
|
110 | """ | |
111 | nb_copy = copy.deepcopy(nb) |
|
111 | nb_copy = copy.deepcopy(nb) | |
112 | resources = self._init_resources(resources) |
|
112 | resources = self._init_resources(resources) |
@@ -27,6 +27,7 b' from IPython.utils.traitlets import MetaHasTraits, Unicode, List, Dict, Any' | |||||
27 | from IPython.utils.importstring import import_item |
|
27 | from IPython.utils.importstring import import_item | |
28 | from IPython.utils import py3compat, text |
|
28 | from IPython.utils import py3compat, text | |
29 |
|
29 | |||
|
30 | from IPython.nbformat.current import docstring_nbformat_mod | |||
30 | from IPython.nbconvert import filters |
|
31 | from IPython.nbconvert import filters | |
31 | from .exporter import Exporter |
|
32 | from .exporter import Exporter | |
32 |
|
33 | |||
@@ -187,15 +188,17 b' class TemplateExporter(Exporter):' | |||||
187 | self.log.info("Loaded template %s", try_name) |
|
188 | self.log.info("Loaded template %s", try_name) | |
188 | break |
|
189 | break | |
189 |
|
190 | |||
|
191 | @docstring_nbformat_mod | |||
190 | def from_notebook_node(self, nb, resources=None, **kw): |
|
192 | def from_notebook_node(self, nb, resources=None, **kw): | |
191 | """ |
|
193 | """ | |
192 | Convert a notebook from a notebook node instance. |
|
194 | Convert a notebook from a notebook node instance. | |
193 |
|
195 | |||
194 | Parameters |
|
196 | Parameters | |
195 | ---------- |
|
197 | ---------- | |
196 | nb : Notebook node |
|
198 | nb : :class:`~{nbformat_mod}.nbbase.NotebookNode` | |
197 | resources : dict (**kw) |
|
199 | Notebook node | |
198 | of additional resources that can be accessed read/write by |
|
200 | resources : dict | |
|
201 | Additional resources that can be accessed read/write by | |||
199 |
|
|
202 | preprocessors and filters. | |
200 | """ |
|
203 | """ | |
201 | nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw) |
|
204 | nb_copy, resources = super(TemplateExporter, self).from_notebook_node(nb, resources, **kw) |
@@ -77,7 +77,7 b' nbconvert_flags.update({' | |||||
77 |
|
77 | |||
78 |
|
78 | |||
79 | class NbConvertApp(BaseIPythonApplication): |
|
79 | class NbConvertApp(BaseIPythonApplication): | |
80 |
"""Application used to convert |
|
80 | """Application used to convert from notebook file type (``*.ipynb``)""" | |
81 |
|
81 | |||
82 | name = 'ipython-nbconvert' |
|
82 | name = 'ipython-nbconvert' | |
83 | aliases = nbconvert_aliases |
|
83 | aliases = nbconvert_aliases |
@@ -18,8 +18,7 b' def cell_preprocessor(function):' | |||||
18 | """ |
|
18 | """ | |
19 | Wrap a function to be executed on all cells of a notebook |
|
19 | Wrap a function to be executed on all cells of a notebook | |
20 |
|
20 | |||
21 | Wrapped Parameters |
|
21 | The wrapped function should have these parameters: | |
22 | ------------------ |
|
|||
23 |
|
22 | |||
24 | cell : NotebookNode cell |
|
23 | cell : NotebookNode cell | |
25 | Notebook cell being processed |
|
24 | Notebook cell being processed |
@@ -88,8 +88,8 b' class TestsBase(unittest.TestCase):' | |||||
88 | Replace "ii" with "i" in the string "Hiiii" yields "Hii" |
|
88 | Replace "ii" with "i" in the string "Hiiii" yields "Hii" | |
89 | Another replacement cds "Hi" (the desired output) |
|
89 | Another replacement cds "Hi" (the desired output) | |
90 |
|
90 | |||
91 |
Parameters |
|
91 | Parameters | |
92 |
---------- |
|
92 | ---------- | |
93 | text : string |
|
93 | text : string | |
94 | Text to replace in. |
|
94 | Text to replace in. | |
95 | search : string |
|
95 | search : string | |
@@ -141,8 +141,8 b' class TestsBase(unittest.TestCase):' | |||||
141 | Execute a, IPython shell command, listening for both Errors and non-zero |
|
141 | Execute a, IPython shell command, listening for both Errors and non-zero | |
142 | return codes. |
|
142 | return codes. | |
143 |
|
143 | |||
144 | PARAMETERS: |
|
144 | Parameters | |
145 |
---------- |
|
145 | ---------- | |
146 | parameters : str |
|
146 | parameters : str | |
147 | List of parameters to pass to IPython. |
|
147 | List of parameters to pass to IPython. | |
148 | ignore_return_code : optional bool (default False) |
|
148 | ignore_return_code : optional bool (default False) |
@@ -31,8 +31,8 b' def convert(nb, to_version):' | |||||
31 | a v4. Also assumes that all conversions can be made in one step increments |
|
31 | a v4. Also assumes that all conversions can be made in one step increments | |
32 | between major versions and ignores minor revisions. |
|
32 | between major versions and ignores minor revisions. | |
33 |
|
33 | |||
34 | PARAMETERS: |
|
34 | Parameters | |
35 |
---------- |
|
35 | ---------- | |
36 | nb : NotebookNode |
|
36 | nb : NotebookNode | |
37 | to_version : int |
|
37 | to_version : int | |
38 | Major revision to convert the notebook to. Can either be an upgrade or |
|
38 | Major revision to convert the notebook to. Can either be an upgrade or |
@@ -30,6 +30,7 b' from IPython.nbformat.v3 import (' | |||||
30 | parse_filename, new_metadata, new_author, new_heading_cell, nbformat, |
|
30 | parse_filename, new_metadata, new_author, new_heading_cell, nbformat, | |
31 | nbformat_minor, to_notebook_json |
|
31 | nbformat_minor, to_notebook_json | |
32 | ) |
|
32 | ) | |
|
33 | from IPython.nbformat import v3 as _v_latest | |||
33 |
|
34 | |||
34 | from .reader import reads as reader_reads |
|
35 | from .reader import reads as reader_reads | |
35 | from .reader import versions |
|
36 | from .reader import versions | |
@@ -41,6 +42,16 b' from .convert import convert' | |||||
41 |
|
42 | |||
42 | current_nbformat = nbformat |
|
43 | current_nbformat = nbformat | |
43 | current_nbformat_minor = nbformat_minor |
|
44 | current_nbformat_minor = nbformat_minor | |
|
45 | current_nbformat_module = _v_latest.__name__ | |||
|
46 | ||||
|
47 | def docstring_nbformat_mod(func): | |||
|
48 | """Decorator for docstrings referring to classes/functions accessed through | |||
|
49 | nbformat.current. | |||
|
50 | ||||
|
51 | Put {nbformat_mod} in the docstring in place of 'IPython.nbformat.v3'. | |||
|
52 | """ | |||
|
53 | func.__doc__ = func.__doc__.format(nbformat_mod=current_nbformat_module) | |||
|
54 | return func | |||
44 |
|
55 | |||
45 |
|
56 | |||
46 | class NBFormatError(ValueError): |
|
57 | class NBFormatError(ValueError): |
@@ -1308,6 +1308,7 b' class HTCondorLauncher(BatchSystemLauncher):' | |||||
1308 | this - the mechanism of shebanged scripts means that the python binary will be |
|
1308 | this - the mechanism of shebanged scripts means that the python binary will be | |
1309 | launched with argv[0] set to the *location of the ip{cluster, engine, controller} |
|
1309 | launched with argv[0] set to the *location of the ip{cluster, engine, controller} | |
1310 | scripts on the remote node*. This means you need to take care that: |
|
1310 | scripts on the remote node*. This means you need to take care that: | |
|
1311 | ||||
1311 |
|
|
1312 | a. Your remote nodes have their paths configured correctly, with the ipengine and ipcontroller | |
1312 |
|
|
1313 | of the python environment you wish to execute code in having top precedence. | |
1313 |
|
|
1314 | b. This functionality is untested on Windows. |
@@ -46,6 +46,7 b' from IPython.core.error import UsageError' | |||||
46 | from IPython.core.magic import Magics |
|
46 | from IPython.core.magic import Magics | |
47 | from IPython.core import magic_arguments |
|
47 | from IPython.core import magic_arguments | |
48 | from IPython.testing.skipdoctest import skip_doctest |
|
48 | from IPython.testing.skipdoctest import skip_doctest | |
|
49 | from IPython.utils.text import dedent | |||
49 |
|
50 | |||
50 | #----------------------------------------------------------------------------- |
|
51 | #----------------------------------------------------------------------------- | |
51 | # Definitions of magic functions for use with IPython |
|
52 | # Definitions of magic functions for use with IPython | |
@@ -108,11 +109,9 b' def output_args(f):' | |||||
108 |
|
109 | |||
109 | Choices are: |
|
110 | Choices are: | |
110 |
|
111 | |||
111 | type: group outputs of all engines by type (stdout, stderr, displaypub, etc.). |
|
112 | **type**: group outputs of all engines by type (stdout, stderr, displaypub, etc.). | |
112 |
|
113 | **engine**: display all output for each engine together. | ||
113 |
|
|
114 | **order**: like type, but individual displaypub output from each engine is collated. | |
114 |
|
||||
115 | order: like type, but individual displaypub output from each engine is collated. |
|
|||
116 |
|
|
115 | For example, if multiple plots are generated by each engine, the first | |
117 |
|
|
116 | figure of each engine will be displayed, then the second of each, etc. | |
118 | """ |
|
117 | """ | |
@@ -435,8 +434,8 b' class ParallelMagics(Magics):' | |||||
435 |
|
434 | |||
436 |
|
435 | |||
437 | __doc__ = __doc__.format( |
|
436 | __doc__ = __doc__.format( | |
438 |
AUTOPX_DOC = |
|
437 | AUTOPX_DOC = dedent(ParallelMagics.autopx.__doc__), | |
439 |
PX_DOC = |
|
438 | PX_DOC = dedent(ParallelMagics.px.__doc__), | |
440 |
RESULT_DOC = |
|
439 | RESULT_DOC = dedent(ParallelMagics.result.__doc__), | |
441 |
CONFIG_DOC = |
|
440 | CONFIG_DOC = dedent(ParallelMagics.pxconfig.__doc__), | |
442 | ) |
|
441 | ) |
@@ -152,8 +152,10 b' class ParallelFunction(RemoteFunction):' | |||||
152 | dist : str [default: 'b'] |
|
152 | dist : str [default: 'b'] | |
153 | The key for which mapObject to use to distribute sequences |
|
153 | The key for which mapObject to use to distribute sequences | |
154 | options are: |
|
154 | options are: | |
|
155 | ||||
155 |
|
|
156 | * 'b' : use contiguous chunks in order | |
156 |
|
|
157 | * 'r' : use round-robin striping | |
|
158 | ||||
157 | block : bool [default: None] |
|
159 | block : bool [default: None] | |
158 | Whether to wait for results or not. The default behavior is |
|
160 | Whether to wait for results or not. The default behavior is | |
159 | to use the current `block` attribute of `view` |
|
161 | to use the current `block` attribute of `view` | |
@@ -162,7 +164,8 b' class ParallelFunction(RemoteFunction):' | |||||
162 | ordered : bool [default: True] |
|
164 | ordered : bool [default: True] | |
163 | Whether the result should be kept in order. If False, |
|
165 | Whether the result should be kept in order. If False, | |
164 | results become available as they arrive, regardless of submission order. |
|
166 | results become available as they arrive, regardless of submission order. | |
165 | **flags : remaining kwargs are passed to View.temp_flags |
|
167 | **flags | |
|
168 | remaining kwargs are passed to View.temp_flags | |||
166 | """ |
|
169 | """ | |
167 |
|
170 | |||
168 | chunksize = None |
|
171 | chunksize = None |
@@ -221,30 +221,27 b' class View(HasTraits):' | |||||
221 | raise NotImplementedError("Implement in subclasses") |
|
221 | raise NotImplementedError("Implement in subclasses") | |
222 |
|
222 | |||
223 | def apply(self, f, *args, **kwargs): |
|
223 | def apply(self, f, *args, **kwargs): | |
224 | """calls f(*args, **kwargs) on remote engines, returning the result. |
|
224 | """calls ``f(*args, **kwargs)`` on remote engines, returning the result. | |
225 |
|
225 | |||
226 | This method sets all apply flags via this View's attributes. |
|
226 | This method sets all apply flags via this View's attributes. | |
227 |
|
227 | |||
228 | if self.block is False: |
|
228 | Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` | |
229 | returns AsyncResult |
|
229 | instance if ``self.block`` is False, otherwise the return value of | |
230 | else: |
|
230 | ``f(*args, **kwargs)``. | |
231 | returns actual result of f(*args, **kwargs) |
|
|||
232 | """ |
|
231 | """ | |
233 | return self._really_apply(f, args, kwargs) |
|
232 | return self._really_apply(f, args, kwargs) | |
234 |
|
233 | |||
235 | def apply_async(self, f, *args, **kwargs): |
|
234 | def apply_async(self, f, *args, **kwargs): | |
236 | """calls f(*args, **kwargs) on remote engines in a nonblocking manner. |
|
235 | """calls ``f(*args, **kwargs)`` on remote engines in a nonblocking manner. | |
237 |
|
236 | |||
238 | returns AsyncResult |
|
237 | Returns :class:`~IPython.parallel.client.asyncresult.AsyncResult` instance. | |
239 | """ |
|
238 | """ | |
240 | return self._really_apply(f, args, kwargs, block=False) |
|
239 | return self._really_apply(f, args, kwargs, block=False) | |
241 |
|
240 | |||
242 | @spin_after |
|
241 | @spin_after | |
243 | def apply_sync(self, f, *args, **kwargs): |
|
242 | def apply_sync(self, f, *args, **kwargs): | |
244 | """calls f(*args, **kwargs) on remote engines in a blocking manner, |
|
243 | """calls ``f(*args, **kwargs)`` on remote engines in a blocking manner, | |
245 | returning the result. |
|
244 | returning the result. | |
246 |
|
||||
247 | returns: actual result of f(*args, **kwargs) |
|
|||
248 | """ |
|
245 | """ | |
249 | return self._really_apply(f, args, kwargs, block=True) |
|
246 | return self._really_apply(f, args, kwargs, block=True) | |
250 |
|
247 | |||
@@ -320,8 +317,7 b' class View(HasTraits):' | |||||
320 | def get_result(self, indices_or_msg_ids=None): |
|
317 | def get_result(self, indices_or_msg_ids=None): | |
321 | """return one or more results, specified by history index or msg_id. |
|
318 | """return one or more results, specified by history index or msg_id. | |
322 |
|
319 | |||
323 | See client.get_result for details. |
|
320 | See :meth:`IPython.parallel.client.client.Client.get_result` for details. | |
324 |
|
||||
325 | """ |
|
321 | """ | |
326 |
|
322 | |||
327 | if indices_or_msg_ids is None: |
|
323 | if indices_or_msg_ids is None: | |
@@ -345,9 +341,9 b' class View(HasTraits):' | |||||
345 | raise NotImplementedError |
|
341 | raise NotImplementedError | |
346 |
|
342 | |||
347 | def map_async(self, f, *sequences, **kwargs): |
|
343 | def map_async(self, f, *sequences, **kwargs): | |
348 | """Parallel version of builtin `map`, using this view's engines. |
|
344 | """Parallel version of builtin :func:`python:map`, using this view's engines. | |
349 |
|
345 | |||
350 | This is equivalent to map(...block=False) |
|
346 | This is equivalent to ``map(...block=False)``. | |
351 |
|
347 | |||
352 | See `self.map` for details. |
|
348 | See `self.map` for details. | |
353 | """ |
|
349 | """ | |
@@ -357,9 +353,9 b' class View(HasTraits):' | |||||
357 | return self.map(f,*sequences,**kwargs) |
|
353 | return self.map(f,*sequences,**kwargs) | |
358 |
|
354 | |||
359 | def map_sync(self, f, *sequences, **kwargs): |
|
355 | def map_sync(self, f, *sequences, **kwargs): | |
360 | """Parallel version of builtin `map`, using this view's engines. |
|
356 | """Parallel version of builtin :func:`python:map`, using this view's engines. | |
361 |
|
357 | |||
362 | This is equivalent to map(...block=True) |
|
358 | This is equivalent to ``map(...block=True)``. | |
363 |
|
359 | |||
364 | See `self.map` for details. |
|
360 | See `self.map` for details. | |
365 | """ |
|
361 | """ | |
@@ -369,7 +365,7 b' class View(HasTraits):' | |||||
369 | return self.map(f,*sequences,**kwargs) |
|
365 | return self.map(f,*sequences,**kwargs) | |
370 |
|
366 | |||
371 | def imap(self, f, *sequences, **kwargs): |
|
367 | def imap(self, f, *sequences, **kwargs): | |
372 | """Parallel version of `itertools.imap`. |
|
368 | """Parallel version of :func:`itertools.imap`. | |
373 |
|
369 | |||
374 | See `self.map` for details. |
|
370 | See `self.map` for details. | |
375 |
|
371 | |||
@@ -575,7 +571,7 b' class DirectView(View):' | |||||
575 |
|
571 | |||
576 | @sync_results |
|
572 | @sync_results | |
577 | def map(self, f, *sequences, **kwargs): |
|
573 | def map(self, f, *sequences, **kwargs): | |
578 | """view.map(f, *sequences, block=self.block) => list|AsyncMapResult |
|
574 | """``view.map(f, *sequences, block=self.block)`` => list|AsyncMapResult | |
579 |
|
575 | |||
580 | Parallel version of builtin `map`, using this View's `targets`. |
|
576 | Parallel version of builtin `map`, using this View's `targets`. | |
581 |
|
577 | |||
@@ -597,14 +593,14 b' class DirectView(View):' | |||||
597 | Returns |
|
593 | Returns | |
598 | ------- |
|
594 | ------- | |
599 |
|
595 | |||
600 | if block=False: |
|
596 | ||
601 | AsyncMapResult |
|
597 | If block=False | |
|
598 | An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. | |||
602 |
|
|
599 | An object like AsyncResult, but which reassembles the sequence of results | |
603 |
|
|
600 | into a single list. AsyncMapResults can be iterated through before all | |
604 |
|
|
601 | results are complete. | |
605 |
else |
|
602 | else | |
606 | list |
|
603 | A list, the result of ``map(f,*sequences)`` | |
607 | the result of map(f,*sequences) |
|
|||
608 | """ |
|
604 | """ | |
609 |
|
605 | |||
610 | block = kwargs.pop('block', self.block) |
|
606 | block = kwargs.pop('block', self.block) | |
@@ -1056,7 +1052,7 b' class LoadBalancedView(View):' | |||||
1056 | @sync_results |
|
1052 | @sync_results | |
1057 | @save_ids |
|
1053 | @save_ids | |
1058 | def map(self, f, *sequences, **kwargs): |
|
1054 | def map(self, f, *sequences, **kwargs): | |
1059 | """view.map(f, *sequences, block=self.block, chunksize=1, ordered=True) => list|AsyncMapResult |
|
1055 | """``view.map(f, *sequences, block=self.block, chunksize=1, ordered=True)`` => list|AsyncMapResult | |
1060 |
|
1056 | |||
1061 | Parallel version of builtin `map`, load-balanced by this View. |
|
1057 | Parallel version of builtin `map`, load-balanced by this View. | |
1062 |
|
1058 | |||
@@ -1091,14 +1087,13 b' class LoadBalancedView(View):' | |||||
1091 | Returns |
|
1087 | Returns | |
1092 | ------- |
|
1088 | ------- | |
1093 |
|
1089 | |||
1094 |
if block=False |
|
1090 | if block=False | |
1095 | AsyncMapResult |
|
1091 | An :class:`~IPython.parallel.client.asyncresult.AsyncMapResult` instance. | |
1096 |
|
|
1092 | An object like AsyncResult, but which reassembles the sequence of results | |
1097 |
|
|
1093 | into a single list. AsyncMapResults can be iterated through before all | |
1098 |
|
|
1094 | results are complete. | |
1099 |
|
|
1095 | else | |
1100 |
|
|
1096 | A list, the result of ``map(f,*sequences)`` | |
1101 |
|
||||
1102 | """ |
|
1097 | """ | |
1103 |
|
1098 | |||
1104 | # default |
|
1099 | # default |
@@ -105,8 +105,7 b' def require(*objects, **mapping):' | |||||
105 | and will be pushed to the engine with their __name__. |
|
105 | and will be pushed to the engine with their __name__. | |
106 | Other objects can be passed by keyword arg. |
|
106 | Other objects can be passed by keyword arg. | |
107 |
|
107 | |||
108 | Examples |
|
108 | Examples:: | |
109 | -------- |
|
|||
110 |
|
109 | |||
111 | In [1]: @require('numpy') |
|
110 | In [1]: @require('numpy') | |
112 | ...: def norm(a): |
|
111 | ...: def norm(a): |
@@ -6,7 +6,8 b' Authors:' | |||||
6 | * Min RK |
|
6 | * Min RK | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | TaskRecords are dicts of the form: |
|
9 | TaskRecords are dicts of the form:: | |
|
10 | ||||
10 | { |
|
11 | { | |
11 | 'msg_id' : str(uuid), |
|
12 | 'msg_id' : str(uuid), | |
12 | 'client_uuid' : str(uuid), |
|
13 | 'client_uuid' : str(uuid), | |
@@ -22,21 +23,25 b' TaskRecords are dicts of the form:' | |||||
22 | 'result_content' : dict(content) or None, |
|
23 | 'result_content' : dict(content) or None, | |
23 | 'result_buffers' : list(buffers) or None, |
|
24 | 'result_buffers' : list(buffers) or None, | |
24 | } |
|
25 | } | |
25 | With this info, many of the special categories of tasks can be defined by query: |
|
|||
26 |
|
26 | |||
27 | pending: completed is None |
|
27 | With this info, many of the special categories of tasks can be defined by query, | |
28 | client's outstanding: client_uuid = uuid && completed is None |
|
28 | e.g.: | |
29 | MIA: arrived is None (and completed is None) |
|
29 | ||
30 | etc. |
|
30 | * pending: completed is None | |
|
31 | * client's outstanding: client_uuid = uuid && completed is None | |||
|
32 | * MIA: arrived is None (and completed is None) | |||
|
33 | ||||
|
34 | EngineRecords are dicts of the form:: | |||
31 |
|
35 | |||
32 | EngineRecords are dicts of the form: |
|
|||
33 | { |
|
36 | { | |
34 | 'eid' : int(id), |
|
37 | 'eid' : int(id), | |
35 | 'uuid': str(uuid) |
|
38 | 'uuid': str(uuid) | |
36 | } |
|
39 | } | |
|
40 | ||||
37 | This may be extended, but is currently. |
|
41 | This may be extended, but is currently. | |
38 |
|
42 | |||
39 | We support a subset of mongodb operators: |
|
43 | We support a subset of mongodb operators:: | |
|
44 | ||||
40 | $lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists |
|
45 | $lt,$gt,$lte,$gte,$ne,$in,$nin,$all,$mod,$exists | |
41 | """ |
|
46 | """ | |
42 | #----------------------------------------------------------------------------- |
|
47 | #----------------------------------------------------------------------------- |
@@ -1149,11 +1149,15 b' class Hub(SessionFactory):' | |||||
1149 |
|
1149 | |||
1150 | def queue_status(self, client_id, msg): |
|
1150 | def queue_status(self, client_id, msg): | |
1151 | """Return the Queue status of one or more targets. |
|
1151 | """Return the Queue status of one or more targets. | |
1152 | if verbose: return the msg_ids |
|
1152 | ||
1153 |
else |
|
1153 | If verbose, return the msg_ids, else return len of each type. | |
1154 | keys: queue (pending MUX jobs) |
|
1154 | ||
1155 | tasks (pending Task jobs) |
|
1155 | Keys: | |
1156 | completed (finished jobs from both queues)""" |
|
1156 | ||
|
1157 | * queue (pending MUX jobs) | |||
|
1158 | * tasks (pending Task jobs) | |||
|
1159 | * completed (finished jobs from both queues) | |||
|
1160 | """ | |||
1157 | content = msg['content'] |
|
1161 | content = msg['content'] | |
1158 | targets = content['targets'] |
|
1162 | targets = content['targets'] | |
1159 | try: |
|
1163 | try: |
@@ -199,7 +199,8 b' def disambiguate_url(url, location=None):' | |||||
199 | """turn multi-ip interfaces '0.0.0.0' and '*' into connectable |
|
199 | """turn multi-ip interfaces '0.0.0.0' and '*' into connectable | |
200 | ones, based on the location (default interpretation is localhost). |
|
200 | ones, based on the location (default interpretation is localhost). | |
201 |
|
201 | |||
202 |
This is for zeromq urls, such as tcp://*:10101. |
|
202 | This is for zeromq urls, such as ``tcp://*:10101``. | |
|
203 | """ | |||
203 | try: |
|
204 | try: | |
204 | proto,ip,port = split_url(url) |
|
205 | proto,ip,port = split_url(url) | |
205 | except AssertionError: |
|
206 | except AssertionError: |
@@ -236,8 +236,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
236 | def __init__(self, parent=None, **kw): |
|
236 | def __init__(self, parent=None, **kw): | |
237 | """ Create a ConsoleWidget. |
|
237 | """ Create a ConsoleWidget. | |
238 |
|
238 | |||
239 |
Parameters |
|
239 | Parameters | |
240 |
---------- |
|
240 | ---------- | |
241 | parent : QWidget, optional [default None] |
|
241 | parent : QWidget, optional [default None] | |
242 | The parent for this widget. |
|
242 | The parent for this widget. | |
243 | """ |
|
243 | """ | |
@@ -543,8 +543,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
543 | def clear(self, keep_input=True): |
|
543 | def clear(self, keep_input=True): | |
544 | """ Clear the console. |
|
544 | """ Clear the console. | |
545 |
|
545 | |||
546 |
Parameters |
|
546 | Parameters | |
547 |
---------- |
|
547 | ---------- | |
548 | keep_input : bool, optional (default True) |
|
548 | keep_input : bool, optional (default True) | |
549 | If set, restores the old input buffer if a new prompt is written. |
|
549 | If set, restores the old input buffer if a new prompt is written. | |
550 | """ |
|
550 | """ | |
@@ -580,8 +580,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
580 | """ Executes source or the input buffer, possibly prompting for more |
|
580 | """ Executes source or the input buffer, possibly prompting for more | |
581 | input. |
|
581 | input. | |
582 |
|
582 | |||
583 |
Parameters |
|
583 | Parameters | |
584 |
---------- |
|
584 | ---------- | |
585 | source : str, optional |
|
585 | source : str, optional | |
586 |
|
586 | |||
587 | The source to execute. If not specified, the input buffer will be |
|
587 | The source to execute. If not specified, the input buffer will be | |
@@ -600,14 +600,14 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
600 | entered by the user. The effect of this parameter depends on the |
|
600 | entered by the user. The effect of this parameter depends on the | |
601 | subclass implementation. |
|
601 | subclass implementation. | |
602 |
|
602 | |||
603 |
Raises |
|
603 | Raises | |
604 |
------ |
|
604 | ------ | |
605 | RuntimeError |
|
605 | RuntimeError | |
606 | If incomplete input is given and 'hidden' is True. In this case, |
|
606 | If incomplete input is given and 'hidden' is True. In this case, | |
607 | it is not possible to prompt for more input. |
|
607 | it is not possible to prompt for more input. | |
608 |
|
608 | |||
609 |
Returns |
|
609 | Returns | |
610 |
------- |
|
610 | ------- | |
611 | A boolean indicating whether the source was executed. |
|
611 | A boolean indicating whether the source was executed. | |
612 | """ |
|
612 | """ | |
613 | # WARNING: The order in which things happen here is very particular, in |
|
613 | # WARNING: The order in which things happen here is very particular, in | |
@@ -746,8 +746,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
746 | def paste(self, mode=QtGui.QClipboard.Clipboard): |
|
746 | def paste(self, mode=QtGui.QClipboard.Clipboard): | |
747 | """ Paste the contents of the clipboard into the input region. |
|
747 | """ Paste the contents of the clipboard into the input region. | |
748 |
|
748 | |||
749 |
Parameters |
|
749 | Parameters | |
750 |
---------- |
|
750 | ---------- | |
751 | mode : QClipboard::Mode, optional [default QClipboard::Clipboard] |
|
751 | mode : QClipboard::Mode, optional [default QClipboard::Clipboard] | |
752 |
|
752 | |||
753 | Controls which part of the system clipboard is used. This can be |
|
753 | Controls which part of the system clipboard is used. This can be | |
@@ -1060,8 +1060,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
1060 | """ Given a KeyboardModifiers flags object, return whether the Control |
|
1060 | """ Given a KeyboardModifiers flags object, return whether the Control | |
1061 | key is down. |
|
1061 | key is down. | |
1062 |
|
1062 | |||
1063 |
Parameters |
|
1063 | Parameters | |
1064 |
---------- |
|
1064 | ---------- | |
1065 | include_command : bool, optional (default True) |
|
1065 | include_command : bool, optional (default True) | |
1066 | Whether to treat the Command key as a (mutually exclusive) synonym |
|
1066 | Whether to treat the Command key as a (mutually exclusive) synonym | |
1067 | for Control when in Mac OS. |
|
1067 | for Control when in Mac OS. | |
@@ -1868,8 +1868,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
1868 | """ Displays text using the pager if it exceeds the height of the |
|
1868 | """ Displays text using the pager if it exceeds the height of the | |
1869 | viewport. |
|
1869 | viewport. | |
1870 |
|
1870 | |||
1871 |
Parameters |
|
1871 | Parameters | |
1872 |
---------- |
|
1872 | ---------- | |
1873 | html : bool, optional (default False) |
|
1873 | html : bool, optional (default False) | |
1874 | If set, the text will be interpreted as HTML instead of plain text. |
|
1874 | If set, the text will be interpreted as HTML instead of plain text. | |
1875 | """ |
|
1875 | """ | |
@@ -1903,11 +1903,8 b" class ConsoleWidget(MetaQObjectHasTraits('NewBase', (LoggingConfigurable, QtGui." | |||||
1903 | """ |
|
1903 | """ | |
1904 | Change the pager to `paging` style. |
|
1904 | Change the pager to `paging` style. | |
1905 |
|
1905 | |||
1906 | XXX: currently, this is limited to switching between 'hsplit' and |
|
1906 | Parameters | |
1907 | 'vsplit'. |
|
1907 | ---------- | |
1908 |
|
||||
1909 | Parameters: |
|
|||
1910 | ----------- |
|
|||
1911 | paging : string |
|
1908 | paging : string | |
1912 | Either "hsplit", "vsplit", or "inside" |
|
1909 | Either "hsplit", "vsplit", or "inside" | |
1913 | """ |
|
1910 | """ |
@@ -155,15 +155,15 b' class HistoryConsoleWidget(ConsoleWidget):' | |||||
155 | def history_previous(self, substring='', as_prefix=True): |
|
155 | def history_previous(self, substring='', as_prefix=True): | |
156 | """ If possible, set the input buffer to a previous history item. |
|
156 | """ If possible, set the input buffer to a previous history item. | |
157 |
|
157 | |||
158 |
Parameters |
|
158 | Parameters | |
159 |
---------- |
|
159 | ---------- | |
160 | substring : str, optional |
|
160 | substring : str, optional | |
161 | If specified, search for an item with this substring. |
|
161 | If specified, search for an item with this substring. | |
162 | as_prefix : bool, optional |
|
162 | as_prefix : bool, optional | |
163 | If True, the substring must match at the beginning (default). |
|
163 | If True, the substring must match at the beginning (default). | |
164 |
|
164 | |||
165 |
Returns |
|
165 | Returns | |
166 |
------- |
|
166 | ------- | |
167 | Whether the input buffer was changed. |
|
167 | Whether the input buffer was changed. | |
168 | """ |
|
168 | """ | |
169 | index = self._history_index |
|
169 | index = self._history_index | |
@@ -186,15 +186,15 b' class HistoryConsoleWidget(ConsoleWidget):' | |||||
186 | def history_next(self, substring='', as_prefix=True): |
|
186 | def history_next(self, substring='', as_prefix=True): | |
187 | """ If possible, set the input buffer to a subsequent history item. |
|
187 | """ If possible, set the input buffer to a subsequent history item. | |
188 |
|
188 | |||
189 |
Parameters |
|
189 | Parameters | |
190 |
---------- |
|
190 | ---------- | |
191 | substring : str, optional |
|
191 | substring : str, optional | |
192 | If specified, search for an item with this substring. |
|
192 | If specified, search for an item with this substring. | |
193 | as_prefix : bool, optional |
|
193 | as_prefix : bool, optional | |
194 | If True, the substring must match at the beginning (default). |
|
194 | If True, the substring must match at the beginning (default). | |
195 |
|
195 | |||
196 |
Returns |
|
196 | Returns | |
197 |
------- |
|
197 | ------- | |
198 | Whether the input buffer was changed. |
|
198 | Whether the input buffer was changed. | |
199 | """ |
|
199 | """ | |
200 | index = self._history_index |
|
200 | index = self._history_index | |
@@ -217,8 +217,8 b' class HistoryConsoleWidget(ConsoleWidget):' | |||||
217 | def history_tail(self, n=10): |
|
217 | def history_tail(self, n=10): | |
218 | """ Get the local history list. |
|
218 | """ Get the local history list. | |
219 |
|
219 | |||
220 |
Parameters |
|
220 | Parameters | |
221 |
---------- |
|
221 | ---------- | |
222 | n : int |
|
222 | n : int | |
223 | The (maximum) number of history items to get. |
|
223 | The (maximum) number of history items to get. | |
224 | """ |
|
224 | """ |
@@ -438,8 +438,8 b' class IPythonWidget(FrontendWidget):' | |||||
438 | def set_default_style(self, colors='lightbg'): |
|
438 | def set_default_style(self, colors='lightbg'): | |
439 | """ Sets the widget style to the class defaults. |
|
439 | """ Sets the widget style to the class defaults. | |
440 |
|
440 | |||
441 |
Parameters |
|
441 | Parameters | |
442 |
---------- |
|
442 | ---------- | |
443 | colors : str, optional (default lightbg) |
|
443 | colors : str, optional (default lightbg) | |
444 | Whether to use the default IPython light background or dark |
|
444 | Whether to use the default IPython light background or dark | |
445 | background or B&W style. |
|
445 | background or B&W style. | |
@@ -464,8 +464,8 b' class IPythonWidget(FrontendWidget):' | |||||
464 | def _edit(self, filename, line=None): |
|
464 | def _edit(self, filename, line=None): | |
465 | """ Opens a Python script for editing. |
|
465 | """ Opens a Python script for editing. | |
466 |
|
466 | |||
467 |
Parameters |
|
467 | Parameters | |
468 |
---------- |
|
468 | ---------- | |
469 | filename : str |
|
469 | filename : str | |
470 | A path to a local system file. |
|
470 | A path to a local system file. | |
471 |
|
471 |
@@ -32,8 +32,8 b' class KillRing(object):' | |||||
32 | def yank(self): |
|
32 | def yank(self): | |
33 | """ Yank back the most recently killed text. |
|
33 | """ Yank back the most recently killed text. | |
34 |
|
34 | |||
35 |
Returns |
|
35 | Returns | |
36 |
------- |
|
36 | ------- | |
37 | A text string or None. |
|
37 | A text string or None. | |
38 | """ |
|
38 | """ | |
39 | self._index = len(self._ring) |
|
39 | self._index = len(self._ring) | |
@@ -42,8 +42,8 b' class KillRing(object):' | |||||
42 | def rotate(self): |
|
42 | def rotate(self): | |
43 | """ Rotate the kill ring, then yank back the new top. |
|
43 | """ Rotate the kill ring, then yank back the new top. | |
44 |
|
44 | |||
45 |
Returns |
|
45 | Returns | |
46 |
------- |
|
46 | ------- | |
47 | A text string or None. |
|
47 | A text string or None. | |
48 | """ |
|
48 | """ | |
49 | self._index -= 1 |
|
49 | self._index -= 1 |
@@ -673,8 +673,8 b' class MainWindow(QtGui.QMainWindow):' | |||||
673 | def _get_magic_menu(self,menuidentifier, menulabel=None): |
|
673 | def _get_magic_menu(self,menuidentifier, menulabel=None): | |
674 | """return a submagic menu by name, and create it if needed |
|
674 | """return a submagic menu by name, and create it if needed | |
675 |
|
675 | |||
676 |
|
|
676 | Parameters | |
677 |
---------- |
|
677 | ---------- | |
678 |
|
678 | |||
679 | menulabel : str |
|
679 | menulabel : str | |
680 | Label for the menu |
|
680 | Label for the menu |
@@ -36,6 +36,10 b' import sys' | |||||
36 | if os.name == 'nt': |
|
36 | if os.name == 'nt': | |
37 | old_excepthook = sys.excepthook |
|
37 | old_excepthook = sys.excepthook | |
38 |
|
38 | |||
|
39 | # Exclude this from our autogenerated API docs. | |||
|
40 | undoc = lambda func: func | |||
|
41 | ||||
|
42 | @undoc | |||
39 | def gui_excepthook(exctype, value, tb): |
|
43 | def gui_excepthook(exctype, value, tb): | |
40 | try: |
|
44 | try: | |
41 | import ctypes, traceback |
|
45 | import ctypes, traceback |
@@ -126,8 +126,8 b' class HtmlExporter(object):' | |||||
126 | def export_html(html, filename, image_tag = None, inline = True): |
|
126 | def export_html(html, filename, image_tag = None, inline = True): | |
127 | """ Export the contents of the ConsoleWidget as HTML. |
|
127 | """ Export the contents of the ConsoleWidget as HTML. | |
128 |
|
128 | |||
129 |
Parameters |
|
129 | Parameters | |
130 |
---------- |
|
130 | ---------- | |
131 | html : unicode, |
|
131 | html : unicode, | |
132 | A Python unicode string containing the Qt HTML to export. |
|
132 | A Python unicode string containing the Qt HTML to export. | |
133 |
|
133 | |||
@@ -162,8 +162,8 b' def export_html(html, filename, image_tag = None, inline = True):' | |||||
162 | def export_xhtml(html, filename, image_tag=None): |
|
162 | def export_xhtml(html, filename, image_tag=None): | |
163 | """ Export the contents of the ConsoleWidget as XHTML with inline SVGs. |
|
163 | """ Export the contents of the ConsoleWidget as XHTML with inline SVGs. | |
164 |
|
164 | |||
165 |
Parameters |
|
165 | Parameters | |
166 |
---------- |
|
166 | ---------- | |
167 | html : unicode, |
|
167 | html : unicode, | |
168 | A Python unicode string containing the Qt HTML to export. |
|
168 | A Python unicode string containing the Qt HTML to export. | |
169 |
|
169 | |||
@@ -216,8 +216,8 b' def default_image_tag(match, path = None, format = "png"):' | |||||
216 | def fix_html(html): |
|
216 | def fix_html(html): | |
217 | """ Transforms a Qt-generated HTML string into a standards-compliant one. |
|
217 | """ Transforms a Qt-generated HTML string into a standards-compliant one. | |
218 |
|
218 | |||
219 |
Parameters |
|
219 | Parameters | |
220 |
---------- |
|
220 | ---------- | |
221 | html : unicode, |
|
221 | html : unicode, | |
222 | A Python unicode string containing the Qt HTML. |
|
222 | A Python unicode string containing the Qt HTML. | |
223 | """ |
|
223 | """ |
@@ -10,16 +10,16 b' from IPython.utils.py3compat import unicode_type' | |||||
10 | def save_svg(string, parent=None): |
|
10 | def save_svg(string, parent=None): | |
11 | """ Prompts the user to save an SVG document to disk. |
|
11 | """ Prompts the user to save an SVG document to disk. | |
12 |
|
12 | |||
13 |
Parameters |
|
13 | Parameters | |
14 |
---------- |
|
14 | ---------- | |
15 | string : basestring |
|
15 | string : basestring | |
16 | A Python string containing a SVG document. |
|
16 | A Python string containing a SVG document. | |
17 |
|
17 | |||
18 | parent : QWidget, optional |
|
18 | parent : QWidget, optional | |
19 | The parent to use for the file dialog. |
|
19 | The parent to use for the file dialog. | |
20 |
|
20 | |||
21 |
Returns |
|
21 | Returns | |
22 |
------- |
|
22 | ------- | |
23 | The name of the file to which the document was saved, or None if the save |
|
23 | The name of the file to which the document was saved, or None if the save | |
24 | was cancelled. |
|
24 | was cancelled. | |
25 | """ |
|
25 | """ | |
@@ -43,8 +43,8 b' def save_svg(string, parent=None):' | |||||
43 | def svg_to_clipboard(string): |
|
43 | def svg_to_clipboard(string): | |
44 | """ Copy a SVG document to the clipboard. |
|
44 | """ Copy a SVG document to the clipboard. | |
45 |
|
45 | |||
46 |
Parameters |
|
46 | Parameters | |
47 |
---------- |
|
47 | ---------- | |
48 | string : basestring |
|
48 | string : basestring | |
49 | A Python string containing a SVG document. |
|
49 | A Python string containing a SVG document. | |
50 | """ |
|
50 | """ | |
@@ -58,8 +58,8 b' def svg_to_clipboard(string):' | |||||
58 | def svg_to_image(string, size=None): |
|
58 | def svg_to_image(string, size=None): | |
59 | """ Convert a SVG document to a QImage. |
|
59 | """ Convert a SVG document to a QImage. | |
60 |
|
60 | |||
61 |
Parameters |
|
61 | Parameters | |
62 |
---------- |
|
62 | ---------- | |
63 | string : basestring |
|
63 | string : basestring | |
64 | A Python string containing a SVG document. |
|
64 | A Python string containing a SVG document. | |
65 |
|
65 | |||
@@ -67,13 +67,13 b' def svg_to_image(string, size=None):' | |||||
67 | The size of the image that is produced. If not specified, the SVG |
|
67 | The size of the image that is produced. If not specified, the SVG | |
68 | document's default size is used. |
|
68 | document's default size is used. | |
69 |
|
69 | |||
70 |
Raises |
|
70 | Raises | |
71 |
------ |
|
71 | ------ | |
72 | ValueError |
|
72 | ValueError | |
73 | If an invalid SVG string is provided. |
|
73 | If an invalid SVG string is provided. | |
74 |
|
74 | |||
75 |
Returns |
|
75 | Returns | |
76 |
------- |
|
76 | ------- | |
77 | A QImage of format QImage.Format_ARGB32. |
|
77 | A QImage of format QImage.Format_ARGB32. | |
78 | """ |
|
78 | """ | |
79 | if isinstance(string, unicode_type): |
|
79 | if isinstance(string, unicode_type): |
@@ -31,7 +31,6 b' ipython_promptin:' | |||||
31 | The default is 'In [%d]:'. This expects that the line numbers are used |
|
31 | The default is 'In [%d]:'. This expects that the line numbers are used | |
32 | in the prompt. |
|
32 | in the prompt. | |
33 | ipython_promptout: |
|
33 | ipython_promptout: | |
34 |
|
||||
35 | The string to represent the IPython prompt in the generated ReST. The |
|
34 | The string to represent the IPython prompt in the generated ReST. The | |
36 | default is 'Out [%d]:'. This expects that the line numbers are used |
|
35 | default is 'Out [%d]:'. This expects that the line numbers are used | |
37 | in the prompt. |
|
36 | in the prompt. |
@@ -161,30 +161,28 b' class InteractiveShellEmbed(TerminalInteractiveShell):' | |||||
161 | display_banner=None, global_ns=None, compile_flags=None): |
|
161 | display_banner=None, global_ns=None, compile_flags=None): | |
162 | """Embeds IPython into a running python program. |
|
162 | """Embeds IPython into a running python program. | |
163 |
|
163 | |||
164 | Input: |
|
164 | Parameters | |
165 |
|
165 | ---------- | ||
166 | - header: An optional header message can be specified. |
|
166 | ||
167 |
|
167 | local_ns, module | ||
168 |
|
|
168 | Working local namespace (a dict) and module (a module or similar | |
169 |
|
|
169 | object). If given as None, they are automatically taken from the scope | |
170 |
|
|
170 | where the shell was called, so that program variables become visible. | |
171 | program variables become visible. |
|
171 | ||
172 |
|
172 | stack_depth : int | ||
173 |
|
|
173 | How many levels in the stack to go to looking for namespaces (when | |
174 | looking for namespaces (when local_ns or module is None). This |
|
174 | local_ns or module is None). This allows an intermediate caller to | |
175 | allows an intermediate caller to make sure that this function gets |
|
175 | make sure that this function gets the namespace from the intended | |
176 | the namespace from the intended level in the stack. By default (0) |
|
176 | level in the stack. By default (0) it will get its locals and globals | |
177 |
|
|
177 | from the immediate caller. | |
178 |
|
178 | |||
179 | - compile_flags: A bit field identifying the __future__ features |
|
179 | compile_flags | |
180 | that are enabled, as passed to the builtin `compile` function. If |
|
180 | A bit field identifying the __future__ features | |
181 | given as None, they are automatically taken from the scope where the |
|
181 | that are enabled, as passed to the builtin :func:`compile` function. | |
182 | shell was called. |
|
182 | If given as None, they are automatically taken from the scope where | |
183 |
|
183 | the shell was called. | ||
184 | Warning: it's possible to use this in a program which is being run by |
|
184 | ||
185 | IPython itself (via %run), but some funny things will happen (a few |
|
185 | """ | |
186 | globals get overwritten). In the future this will be cleaned up, as |
|
|||
187 | there is no fundamental reason why it can't work perfectly.""" |
|
|||
188 |
|
186 | |||
189 | if (global_ns is not None) and (module is None): |
|
187 | if (global_ns is not None) and (module is None): | |
190 | warnings.warn("global_ns is deprecated, use module instead.", DeprecationWarning) |
|
188 | warnings.warn("global_ns is deprecated, use module instead.", DeprecationWarning) |
@@ -191,8 +191,7 b' class TerminalMagics(Magics):' | |||||
191 | This assigns the pasted block to variable 'foo' as string, without |
|
191 | This assigns the pasted block to variable 'foo' as string, without | |
192 | executing it (preceding >>> and + is still stripped). |
|
192 | executing it (preceding >>> and + is still stripped). | |
193 |
|
193 | |||
194 | Options |
|
194 | Options: | |
195 | ------- |
|
|||
196 |
|
195 | |||
197 | -r: re-executes the block previously entered by cpaste. |
|
196 | -r: re-executes the block previously entered by cpaste. | |
198 |
|
197 | |||
@@ -561,12 +560,11 b' class TerminalInteractiveShell(InteractiveShell):' | |||||
561 | The returned line does not include the trailing newline. |
|
560 | The returned line does not include the trailing newline. | |
562 | When the user enters the EOF key sequence, EOFError is raised. |
|
561 | When the user enters the EOF key sequence, EOFError is raised. | |
563 |
|
562 | |||
564 | Optional inputs: |
|
563 | Parameters | |
|
564 | ---------- | |||
565 |
|
565 | |||
566 | - prompt(''): a string to be printed to prompt the user. |
|
566 | prompt : str, optional | |
567 |
|
567 | A string to be printed to prompt the user. | ||
568 | - continue_prompt(False): whether this line is the first one or a |
|
|||
569 | continuation in a sequence of inputs. |
|
|||
570 | """ |
|
568 | """ | |
571 | # Code run by the user may have modified the readline completer state. |
|
569 | # Code run by the user may have modified the readline completer state. | |
572 | # We must ensure that our completer is back in place. |
|
570 | # We must ensure that our completer is back in place. |
@@ -175,13 +175,14 b' def skipif(skip_condition, msg=None):' | |||||
175 |
|
175 | |||
176 | Parameters |
|
176 | Parameters | |
177 | ---------- |
|
177 | ---------- | |
178 | skip_condition : bool or callable. |
|
178 | ||
|
179 | skip_condition : bool or callable | |||
179 |
|
|
180 | Flag to determine whether to skip test. If the condition is a | |
180 |
|
|
181 | callable, it is used at runtime to dynamically make the decision. This | |
181 |
|
|
182 | is useful for tests that may require costly imports, to delay the cost | |
182 |
|
|
183 | until the test suite is actually executed. | |
183 | msg : string |
|
184 | msg : string | |
184 |
|
|
185 | Message to give on raising a SkipTest exception. | |
185 |
|
186 | |||
186 | Returns |
|
187 | Returns | |
187 | ------- |
|
188 | ------- |
@@ -59,7 +59,7 b' def full_path(startPath,files):' | |||||
59 | """Make full paths for all the listed files, based on startPath. |
|
59 | """Make full paths for all the listed files, based on startPath. | |
60 |
|
60 | |||
61 | Only the base part of startPath is kept, since this routine is typically |
|
61 | Only the base part of startPath is kept, since this routine is typically | |
62 |
used with a script's __file__ variable as startPath. |
|
62 | used with a script's ``__file__`` variable as startPath. The base of startPath | |
63 | is then prepended to all the listed files, forming the output list. |
|
63 | is then prepended to all the listed files, forming the output list. | |
64 |
|
64 | |||
65 | Parameters |
|
65 | Parameters | |
@@ -80,7 +80,8 b' def full_path(startPath,files):' | |||||
80 | >>> full_path('/foo',['a.txt','b.txt']) |
|
80 | >>> full_path('/foo',['a.txt','b.txt']) | |
81 | ['/a.txt', '/b.txt'] |
|
81 | ['/a.txt', '/b.txt'] | |
82 |
|
82 | |||
83 | If a single file is given, the output is still a list: |
|
83 | If a single file is given, the output is still a list:: | |
|
84 | ||||
84 | >>> full_path('/foo','a.txt') |
|
85 | >>> full_path('/foo','a.txt') | |
85 | ['/a.txt'] |
|
86 | ['/a.txt'] | |
86 | """ |
|
87 | """ | |
@@ -105,7 +106,8 b' def parse_test_output(txt):' | |||||
105 |
|
106 | |||
106 | Returns |
|
107 | Returns | |
107 | ------- |
|
108 | ------- | |
108 | nerr, nfail: number of errors and failures. |
|
109 | nerr, nfail | |
|
110 | number of errors and failures. | |||
109 | """ |
|
111 | """ | |
110 |
|
112 | |||
111 | err_m = re.search(r'^FAILED \(errors=(\d+)\)', txt, re.MULTILINE) |
|
113 | err_m = re.search(r'^FAILED \(errors=(\d+)\)', txt, re.MULTILINE) |
@@ -81,7 +81,8 b' def belong(candidates,checklist):' | |||||
81 | def with_obj(object, **args): |
|
81 | def with_obj(object, **args): | |
82 | """Set multiple attributes for an object, similar to Pascal's with. |
|
82 | """Set multiple attributes for an object, similar to Pascal's with. | |
83 |
|
83 | |||
84 | Example: |
|
84 | Example:: | |
|
85 | ||||
85 | with_obj(jim, |
|
86 | with_obj(jim, | |
86 | born = 1960, |
|
87 | born = 1960, | |
87 | haircolour = 'Brown', |
|
88 | haircolour = 'Brown', |
@@ -48,8 +48,9 b' color_templates = (' | |||||
48 | def make_color_table(in_class): |
|
48 | def make_color_table(in_class): | |
49 | """Build a set of color attributes in a class. |
|
49 | """Build a set of color attributes in a class. | |
50 |
|
50 | |||
51 |
Helper function for building the |
|
51 | Helper function for building the :class:`TermColors` and | |
52 |
|
52 | :class`InputTermColors`. | ||
|
53 | """ | |||
53 | for name,value in color_templates: |
|
54 | for name,value in color_templates: | |
54 | setattr(in_class,name,in_class._base % value) |
|
55 | setattr(in_class,name,in_class._base % value) | |
55 |
|
56 |
@@ -26,17 +26,20 b' from IPython.utils import py3compat' | |||||
26 | def extract_vars(*names,**kw): |
|
26 | def extract_vars(*names,**kw): | |
27 | """Extract a set of variables by name from another frame. |
|
27 | """Extract a set of variables by name from another frame. | |
28 |
|
28 | |||
29 |
|
|
29 | Parameters | |
30 | - `*names`: strings |
|
30 | ---------- | |
|
31 | *names : str | |||
31 | One or more variable names which will be extracted from the caller's |
|
32 | One or more variable names which will be extracted from the caller's | |
32 | frame. |
|
33 | frame. | |
33 |
|
34 | |||
34 | :Keywords: |
|
35 | depth : integer, optional | |
35 | - `depth`: integer (0) |
|
|||
36 | How many frames in the stack to walk when looking for your variables. |
|
36 | How many frames in the stack to walk when looking for your variables. | |
|
37 | The default is 0, which will use the frame where the call was made. | |||
37 |
|
38 | |||
38 |
|
39 | |||
39 |
Examples |
|
40 | Examples | |
|
41 | -------- | |||
|
42 | :: | |||
40 |
|
43 | |||
41 | In [2]: def func(x): |
|
44 | In [2]: def func(x): | |
42 | ...: y = 1 |
|
45 | ...: y = 1 |
@@ -110,10 +110,10 b' class SList(list):' | |||||
110 |
|
110 | |||
111 | These are normal lists, but with the special attributes: |
|
111 | These are normal lists, but with the special attributes: | |
112 |
|
112 | |||
113 |
|
|
113 | * .l (or .list) : value as list (the list itself). | |
114 |
|
|
114 | * .n (or .nlstr): value as a string, joined on newlines. | |
115 |
|
|
115 | * .s (or .spstr): value as a string, joined on spaces. | |
116 |
|
|
116 | * .p (or .paths): list of path objects | |
117 |
|
117 | |||
118 | Any values which require transformations are computed only once and |
|
118 | Any values which require transformations are computed only once and | |
119 | cached.""" |
|
119 | cached.""" | |
@@ -191,13 +191,14 b' class SList(list):' | |||||
191 | Allows quick awk-like usage of string lists. |
|
191 | Allows quick awk-like usage of string lists. | |
192 |
|
192 | |||
193 | Example data (in var a, created by 'a = !ls -l'):: |
|
193 | Example data (in var a, created by 'a = !ls -l'):: | |
|
194 | ||||
194 | -rwxrwxrwx 1 ville None 18 Dec 14 2006 ChangeLog |
|
195 | -rwxrwxrwx 1 ville None 18 Dec 14 2006 ChangeLog | |
195 | drwxrwxrwx+ 6 ville None 0 Oct 24 18:05 IPython |
|
196 | drwxrwxrwx+ 6 ville None 0 Oct 24 18:05 IPython | |
196 |
|
197 | |||
197 | a.fields(0) is ['-rwxrwxrwx', 'drwxrwxrwx+'] |
|
198 | * ``a.fields(0)`` is ``['-rwxrwxrwx', 'drwxrwxrwx+']`` | |
198 | a.fields(1,0) is ['1 -rwxrwxrwx', '6 drwxrwxrwx+'] |
|
199 | * ``a.fields(1,0)`` is ``['1 -rwxrwxrwx', '6 drwxrwxrwx+']`` | |
199 | (note the joining by space). |
|
200 | (note the joining by space). | |
200 | a.fields(-1) is ['ChangeLog', 'IPython'] |
|
201 | * ``a.fields(-1)`` is ``['ChangeLog', 'IPython']`` | |
201 |
|
202 | |||
202 | IndexErrors are ignored. |
|
203 | IndexErrors are ignored. | |
203 |
|
204 |
@@ -761,8 +761,8 b' class Instance(ClassBasedTraitType):' | |||||
761 | allow_none : bool |
|
761 | allow_none : bool | |
762 | Indicates whether None is allowed as a value. |
|
762 | Indicates whether None is allowed as a value. | |
763 |
|
763 | |||
764 | Default Value |
|
764 | Notes | |
765 |
----- |
|
765 | ----- | |
766 | If both ``args`` and ``kw`` are None, then the default value is None. |
|
766 | If both ``args`` and ``kw`` are None, then the default value is None. | |
767 | If ``args`` is a tuple and ``kw`` is a dict, then the default is |
|
767 | If ``args`` is a tuple and ``kw`` is a dict, then the default is | |
768 | created as ``klass(*args, **kw)``. If either ``args`` or ``kw`` is |
|
768 | created as ``klass(*args, **kw)``. If either ``args`` or ``kw`` is |
@@ -17,45 +17,29 b" if __name__ == '__main__':" | |||||
17 | docwriter = ApiDocWriter(package,rst_extension='.rst') |
|
17 | docwriter = ApiDocWriter(package,rst_extension='.rst') | |
18 | # You have to escape the . here because . is a special char for regexps. |
|
18 | # You have to escape the . here because . is a special char for regexps. | |
19 | # You must do make clean if you change this! |
|
19 | # You must do make clean if you change this! | |
20 |
docwriter.package_skip_patterns += [r'\. |
|
20 | docwriter.package_skip_patterns += [r'\.external$', | |
21 |
|
|
21 | # Extensions are documented elsewhere. | |
22 | r'\.extensions', |
|
22 | r'\.extensions', | |
23 | r'\.kernel\.config', |
|
|||
24 | r'\.attic', |
|
|||
25 | r'\.quarantine', |
|
|||
26 | r'\.deathrow', |
|
|||
27 | r'\.config\.default', |
|
|||
28 | r'\.config\.profile', |
|
23 | r'\.config\.profile', | |
29 | r'\.frontend', |
|
|||
30 | r'\.gui', |
|
|||
31 | r'\.kernel', |
|
|||
32 | # For now, the zmq code has |
|
|||
33 | # unconditional top-level code so it's |
|
|||
34 | # not import safe. This needs fixing |
|
|||
35 | r'\.zmq', |
|
|||
36 | ] |
|
24 | ] | |
37 |
|
25 | |||
38 | docwriter.module_skip_patterns += [ |
|
26 | # The inputhook* modules often cause problems on import, such as trying to | |
39 | r'\.testing\.iptest', |
|
27 | # load incompatible Qt bindings. It's easiest to leave them all out. The | |
40 | # Keeping these disabled is OK |
|
28 | # main API is in the inputhook module, which is documented. | |
41 | r'\.parallel\.controller\.mongodb', |
|
29 | docwriter.module_skip_patterns += [ r'\.lib\.inputhook.+', | |
42 | r'\.lib\.inputhookwx', |
|
|||
43 | r'\.lib\.inputhookgtk', |
|
|||
44 | r'\.cocoa', |
|
|||
45 | r'\.ipdoctest', |
|
30 | r'\.ipdoctest', | |
46 |
r'\. |
|
31 | r'\.testing\.plugin', | |
47 | r'\.frontend\.process\.winprocess', |
|
32 | # This just prints a deprecation msg: | |
48 | r'\.frontend', |
|
33 | r'\.frontend', | |
49 | r'\.Shell', |
|
|||
50 | ] |
|
34 | ] | |
51 |
|
35 | |||
52 | # If we don't have pexpect, we can't load irunner, so skip any code that |
|
36 | # We're rarely working on machines with the Azure SDK installed, so we | |
53 | # depends on it |
|
37 | # skip the module that needs it in that case. | |
54 | try: |
|
38 | try: | |
55 | import pexpect |
|
39 | import azure # analysis:ignore | |
56 | except ImportError: |
|
40 | except ImportError: | |
57 |
docwriter.module_skip_patterns |
|
41 | docwriter.module_skip_patterns.append(r'\.html\.services\.notebooks\.azurenbmanager') | |
58 | r'\.testing\.mkdoctests'] |
|
42 | ||
59 | # Now, generate the outputs |
|
43 | # Now, generate the outputs | |
60 | docwriter.write_api_docs(outdir) |
|
44 | docwriter.write_api_docs(outdir) | |
61 | # Write index with .txt extension - we can include it, but Sphinx won't try |
|
45 | # Write index with .txt extension - we can include it, but Sphinx won't try |
@@ -44,6 +44,7 b' extensions = [' | |||||
44 | 'matplotlib.sphinxext.only_directives', |
|
44 | 'matplotlib.sphinxext.only_directives', | |
45 | 'matplotlib.sphinxext.plot_directive', |
|
45 | 'matplotlib.sphinxext.plot_directive', | |
46 | 'sphinx.ext.autodoc', |
|
46 | 'sphinx.ext.autodoc', | |
|
47 | 'sphinx.ext.autosummary', | |||
47 | 'sphinx.ext.doctest', |
|
48 | 'sphinx.ext.doctest', | |
48 | 'sphinx.ext.inheritance_diagram', |
|
49 | 'sphinx.ext.inheritance_diagram', | |
49 | 'sphinx.ext.intersphinx', |
|
50 | 'sphinx.ext.intersphinx', | |
@@ -179,7 +180,7 b' html_additional_pages = {' | |||||
179 | # Output file base name for HTML help builder. |
|
180 | # Output file base name for HTML help builder. | |
180 | htmlhelp_basename = 'ipythondoc' |
|
181 | htmlhelp_basename = 'ipythondoc' | |
181 |
|
182 | |||
182 |
intersphinx_mapping = {' |
|
183 | intersphinx_mapping = {'python': ('http://docs.python.org/2/', None)} | |
183 |
|
184 | |||
184 | # Options for LaTeX output |
|
185 | # Options for LaTeX output | |
185 | # ------------------------ |
|
186 | # ------------------------ |
@@ -116,8 +116,7 b' The generated comparison, is between your feature branch' | |||||
116 | ``my-new-feature``, and the place in ``master`` from which you branched |
|
116 | ``my-new-feature``, and the place in ``master`` from which you branched | |
117 | ``my-new-feature``. In other words, you can keep updating ``master`` |
|
117 | ``my-new-feature``. In other words, you can keep updating ``master`` | |
118 | without interfering with the output from the comparison. More detail? |
|
118 | without interfering with the output from the comparison. More detail? | |
119 |
Note the three dots in the URL above (``master...my-new-feature``) |
|
119 | Note the three dots in the URL above (``master...my-new-feature``). | |
120 | see :ref:`dot2-dot3`. |
|
|||
121 |
|
120 | |||
122 | Asking for your changes to be merged with the main repo |
|
121 | Asking for your changes to be merged with the main repo | |
123 | ======================================================= |
|
122 | ======================================================= |
@@ -26,3 +26,4 b' on the IPython GitHub wiki.' | |||||
26 | parallel_connections |
|
26 | parallel_connections | |
27 | pycompat |
|
27 | pycompat | |
28 | config |
|
28 | config | |
|
29 | inputhook_app |
@@ -140,7 +140,7 b' Pull requests (257):' | |||||
140 | * `1126 <https://github.com/ipython/ipython/issues/1126>`_: Totally remove pager when read only (notebook) |
|
140 | * `1126 <https://github.com/ipython/ipython/issues/1126>`_: Totally remove pager when read only (notebook) | |
141 | * `1091 <https://github.com/ipython/ipython/issues/1091>`_: qtconsole : allow copy with shortcut in pager |
|
141 | * `1091 <https://github.com/ipython/ipython/issues/1091>`_: qtconsole : allow copy with shortcut in pager | |
142 | * `1114 <https://github.com/ipython/ipython/issues/1114>`_: fix magics history in two-process ipython console |
|
142 | * `1114 <https://github.com/ipython/ipython/issues/1114>`_: fix magics history in two-process ipython console | |
143 |
* `1113 <https://github.com/ipython/ipython/issues/1113>`_: Fixing #1112 removing failing asserts for test_carriage_return and test_ |
|
143 | * `1113 <https://github.com/ipython/ipython/issues/1113>`_: Fixing #1112 removing failing asserts for test_carriage_return and test_beep | |
144 | * `1089 <https://github.com/ipython/ipython/issues/1089>`_: Support carriage return ('\r') and beep ('\b') characters in the qtconsole |
|
144 | * `1089 <https://github.com/ipython/ipython/issues/1089>`_: Support carriage return ('\r') and beep ('\b') characters in the qtconsole | |
145 | * `1108 <https://github.com/ipython/ipython/issues/1108>`_: Completer usability 2 (rebased of pr #1082) |
|
145 | * `1108 <https://github.com/ipython/ipython/issues/1108>`_: Completer usability 2 (rebased of pr #1082) | |
146 | * `864 <https://github.com/ipython/ipython/issues/864>`_: Two-process terminal frontend (ipython core branch) |
|
146 | * `864 <https://github.com/ipython/ipython/issues/864>`_: Two-process terminal frontend (ipython core branch) |
@@ -643,7 +643,7 b' Pull Requests (793):' | |||||
643 | * :ghpull:`3223`: add missing mathjax_url to new settings dict |
|
643 | * :ghpull:`3223`: add missing mathjax_url to new settings dict | |
644 | * :ghpull:`3089`: add stdin to the notebook |
|
644 | * :ghpull:`3089`: add stdin to the notebook | |
645 | * :ghpull:`3221`: Remove references to HTMLCell (dead code) |
|
645 | * :ghpull:`3221`: Remove references to HTMLCell (dead code) | |
646 | * :ghpull:`3205`: add ignored *args to HasTraits constructor |
|
646 | * :ghpull:`3205`: add ignored ``*args`` to HasTraits constructor | |
647 | * :ghpull:`3088`: cleanup IPython handler settings |
|
647 | * :ghpull:`3088`: cleanup IPython handler settings | |
648 | * :ghpull:`3201`: use much faster regexp for ansi coloring |
|
648 | * :ghpull:`3201`: use much faster regexp for ansi coloring | |
649 | * :ghpull:`3220`: avoid race condition in profile creation |
|
649 | * :ghpull:`3220`: avoid race condition in profile creation | |
@@ -1064,7 +1064,7 b' Pull Requests (793):' | |||||
1064 | * :ghpull:`2140`: 2to3: Apply `has_key` fixer. |
|
1064 | * :ghpull:`2140`: 2to3: Apply `has_key` fixer. | |
1065 | * :ghpull:`2131`: Add option append (-a) to %save |
|
1065 | * :ghpull:`2131`: Add option append (-a) to %save | |
1066 | * :ghpull:`2117`: use explicit url in notebook example |
|
1066 | * :ghpull:`2117`: use explicit url in notebook example | |
1067 | * :ghpull:`2133`: Tell git that *.py files contain Python code, for use in word-diffs. |
|
1067 | * :ghpull:`2133`: Tell git that ``*.py`` files contain Python code, for use in word-diffs. | |
1068 | * :ghpull:`2134`: Apply 2to3 `next` fix. |
|
1068 | * :ghpull:`2134`: Apply 2to3 `next` fix. | |
1069 | * :ghpull:`2126`: ipcluster broken with any batch launcher (PBS/LSF/SGE) |
|
1069 | * :ghpull:`2126`: ipcluster broken with any batch launcher (PBS/LSF/SGE) | |
1070 | * :ghpull:`2104`: Windows make file for Sphinx documentation |
|
1070 | * :ghpull:`2104`: Windows make file for Sphinx documentation | |
@@ -1423,7 +1423,7 b' Issues (691):' | |||||
1423 | * :ghissue:`3207`: [Feature] folders for ipython notebook dashboard |
|
1423 | * :ghissue:`3207`: [Feature] folders for ipython notebook dashboard | |
1424 | * :ghissue:`3178`: cell magics do not work with empty lines after #2447 |
|
1424 | * :ghissue:`3178`: cell magics do not work with empty lines after #2447 | |
1425 | * :ghissue:`3204`: Default plot() colors unsuitable for red-green colorblind users |
|
1425 | * :ghissue:`3204`: Default plot() colors unsuitable for red-green colorblind users | |
1426 | * :ghissue:`1789`: :\n/*foo turns into :\n*(foo) in triple-quoted strings. |
|
1426 | * :ghissue:`1789`: ``:\n/*foo`` turns into ``:\n*(foo)`` in triple-quoted strings. | |
1427 | * :ghissue:`3202`: File cell magic fails with blank lines |
|
1427 | * :ghissue:`3202`: File cell magic fails with blank lines | |
1428 | * :ghissue:`3199`: %%cython -a stopped working? |
|
1428 | * :ghissue:`3199`: %%cython -a stopped working? | |
1429 | * :ghissue:`2688`: obsolete imports in import autocompletion |
|
1429 | * :ghissue:`2688`: obsolete imports in import autocompletion | |
@@ -1649,7 +1649,7 b' Issues (691):' | |||||
1649 | * :ghissue:`1308`: ipython qtconsole --ssh=server --existing ... hangs |
|
1649 | * :ghissue:`1308`: ipython qtconsole --ssh=server --existing ... hangs | |
1650 | * :ghissue:`1679`: List command doesn't work in ipdb debugger the first time |
|
1650 | * :ghissue:`1679`: List command doesn't work in ipdb debugger the first time | |
1651 | * :ghissue:`2545`: pypi win32 installer creates 64bit executibles |
|
1651 | * :ghissue:`2545`: pypi win32 installer creates 64bit executibles | |
1652 | * :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (QDialog.exec_ and more) |
|
1652 | * :ghissue:`2080`: Event loop issues with IPython 0.12 and PyQt4 (``QDialog.exec_`` and more) | |
1653 | * :ghissue:`2541`: Allow `python -m IPython` |
|
1653 | * :ghissue:`2541`: Allow `python -m IPython` | |
1654 | * :ghissue:`2508`: subplots_adjust() does not work correctly in ipython notebook |
|
1654 | * :ghissue:`2508`: subplots_adjust() does not work correctly in ipython notebook | |
1655 | * :ghissue:`2289`: Incorrect mathjax rendering of certain arrays of equations |
|
1655 | * :ghissue:`2289`: Incorrect mathjax rendering of certain arrays of equations |
@@ -547,7 +547,7 b' Backwards incompatible changes' | |||||
547 |
|
547 | |||
548 | * Old style configuration files :file:`ipythonrc` and :file:`ipy_user_conf.py` |
|
548 | * Old style configuration files :file:`ipythonrc` and :file:`ipy_user_conf.py` | |
549 | are no longer supported. Users should migrate there configuration files to |
|
549 | are no longer supported. Users should migrate there configuration files to | |
550 | the new format described :doc:`here <config/intro>` and |
|
550 | the new format described :doc:`here </config/intro>` and | |
551 | :ref:`here <config_overview>`. |
|
551 | :ref:`here <config_overview>`. | |
552 |
|
552 | |||
553 | * The old IPython extension API that relied on :func:`ipapi` has been |
|
553 | * The old IPython extension API that relied on :func:`ipapi` has been |
@@ -220,7 +220,7 b' class ApiDocWriter(object):' | |||||
220 | # get the names of all classes and functions |
|
220 | # get the names of all classes and functions | |
221 | functions, classes = self._parse_module(uri) |
|
221 | functions, classes = self._parse_module(uri) | |
222 | if not len(functions) and not len(classes): |
|
222 | if not len(functions) and not len(classes): | |
223 | print ('WARNING: Empty -', uri) # dbg |
|
223 | #print ('WARNING: Empty -', uri) # dbg | |
224 | return '' |
|
224 | return '' | |
225 |
|
225 | |||
226 | # Make a shorter version of the uri that omits the package name for |
|
226 | # Make a shorter version of the uri that omits the package name for | |
@@ -415,7 +415,8 b' class ApiDocWriter(object):' | |||||
415 | idx = open(path,'wt') |
|
415 | idx = open(path,'wt') | |
416 | w = idx.write |
|
416 | w = idx.write | |
417 | w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n') |
|
417 | w('.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n') | |
418 |
w('.. |
|
418 | w('.. autosummary::\n' | |
419 | for f in self.written_modules: |
|
419 | ' :toctree: %s\n\n' % relpath) | |
420 | w(' %s\n' % os.path.join(relpath,f)) |
|
420 | for mod in self.written_modules: | |
|
421 | w(' %s\n' % mod) | |||
421 | idx.close() |
|
422 | idx.close() |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now