##// END OF EJS Templates
Miscellaneous docs fixes
Thomas Kluyver -
Show More
@@ -212,13 +212,13 b' def get_input_encoding():'
212 212 #-----------------------------------------------------------------------------
213 213
214 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 217 This object is designed to be fed python source line-by-line, using
218 :meth:`push`. It will return on each push whether the currently pushed
219 code could be executed already. In addition, it provides a method called
220 :meth:`push_accepts_more` that can be used to query whether more input
221 can be pushed into a single interactive block.
218 :meth:`push`. It will return on each push whether the currently pushed
219 code could be executed already. In addition, it provides a method called
220 :meth:`push_accepts_more` that can be used to query whether more input
221 can be pushed into a single interactive block.
222 222
223 223 This is a simple example of how an interactive terminal-based client can use
224 224 this tool::
@@ -131,9 +131,9 b' def get_default_colors():'
131 131
132 132
133 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 139 def validate(self, obj, value):
@@ -2,7 +2,8 b''
2 2 """
3 3 ultratb.py -- Spice up your tracebacks!
4 4
5 * ColorTB
5 **ColorTB**
6
6 7 I've always found it a bit hard to visually parse tracebacks in Python. The
7 8 ColorTB class is a solution to that problem. It colors the different parts of a
8 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 14 import sys,ultratb
14 15 sys.excepthook = ultratb.ColorTB()
15 16
16 * VerboseTB
17 **VerboseTB**
18
17 19 I've also included a port of Ka-Ping Yee's "cgitb.py" that produces all kinds
18 20 of useful info when a traceback occurs. Ping originally had it spit out HTML
19 21 and intended it for CGI programmers, but why should they have all the fun? I
@@ -145,9 +145,11 b' class NotebookHandler(IPythonHandler):'
145 145
146 146 POST creates new notebooks. The server always decides on the notebook name.
147 147
148 POST /api/notebooks/path : new untitled notebook in path
149 If content specified, upload a notebook, otherwise start empty.
150 POST /api/notebooks/path?copy=OtherNotebook.ipynb : new copy of OtherNotebook in path
148 POST /api/notebooks/path
149 New untitled notebook in path. If content specified, upload a
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 155 if name is not None:
@@ -171,14 +173,15 b' class NotebookHandler(IPythonHandler):'
171 173 def put(self, path='', name=None):
172 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
175 Notebook structure is specified in `content` key of JSON request body.
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
176 PUT is very similar to POST, but the requester specifies the name,
177 whereas with POST, the server picks the name.
178 178
179 POST and PUT are basically the same. The only difference:
180
181 - with POST, server always picks the name, with PUT the requester does
179 PUT /api/notebooks/path/Name.ipynb
180 Save notebook at ``path/Name.ipynb``. Notebook structure is specified
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 186 if name is None:
184 187 raise web.HTTPError(400, "Only PUT to full names. Use POST for directories.")
@@ -133,9 +133,9 b' class ZMQSocketChannel(Thread):'
133 133 def stop(self):
134 134 """Stop the channel's event loop and join its thread.
135 135
136 This calls :method:`Thread.join` and returns when the thread
136 This calls :meth:`~threading.Thread.join` and returns when the thread
137 137 terminates. :class:`RuntimeError` will be raised if
138 :method:`self.start` is called again.
138 :meth:`~threading.Thread.start` is called again.
139 139 """
140 140 self.join()
141 141
@@ -430,7 +430,7 b' class IOPubChannel(ZMQSocketChannel):'
430 430 def flush(self, timeout=1.0):
431 431 """Immediately processes all pending messages on the iopub channel.
432 432
433 Callers should use this method to ensure that :method:`call_handlers`
433 Callers should use this method to ensure that :meth:`call_handlers`
434 434 has been called for all messages that have been received on the
435 435 0MQ SUB socket of this channel.
436 436
@@ -49,8 +49,8 b" def passwd(passphrase=None, algorithm='sha1'):"
49 49
50 50 Examples
51 51 --------
52 In [1]: passwd('mypassword')
53 Out[1]: 'sha1:7cf3:b7d6da294ea9592a9480c8f52e63cd42cfb9dd12'
52 >>> passwd('mypassword')
53 'sha1:7cf3:b7d6da294ea9592a9480c8f52e63cd42cfb9dd12'
54 54
55 55 """
56 56 if passphrase is None:
@@ -89,16 +89,14 b' def passwd_check(hashed_passphrase, passphrase):'
89 89
90 90 Examples
91 91 --------
92 In [1]: from IPython.lib.security import passwd_check
93
94 In [2]: passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
95 ...: 'mypassword')
96 Out[2]: True
97
98 In [3]: passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
99 ...: 'anotherpassword')
100 Out[3]: False
101
92 >>> from IPython.lib.security import passwd_check
93 >>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
94 ... 'mypassword')
95 True
96
97 >>> passwd_check('sha1:0e112c3ddfce:a68df677475c2b47b6e86d0467eec97ac5f4b85a',
98 ... 'anotherpassword')
99 False
102 100 """
103 101 try:
104 102 algorithm, salt, pw_digest = hashed_passphrase.split(':', 2)
@@ -16,7 +16,7 b' Module containing single call export functions.'
16 16 from functools import wraps
17 17
18 18 from IPython.nbformat.v3.nbbase import NotebookNode
19 from IPython.config import Config
19 from IPython.utils.decorators import undoc
20 20 from IPython.utils.py3compat import string_types
21 21
22 22 from .exporter import Exporter
@@ -32,18 +32,20 b' from .rst import RSTExporter'
32 32 # Classes
33 33 #-----------------------------------------------------------------------------
34 34
35 @undoc
35 36 def DocDecorator(f):
36 37
37 38 #Set docstring of function
38 39 f.__doc__ = f.__doc__ + """
39 nb : Notebook node
40 nb : :class:`~IPython.nbformat.v3.nbbase.NotebookNode`
41 The notebook to export.
40 42 config : config (optional, keyword arg)
41 43 User configuration instance.
42 44 resources : dict (optional, keyword arg)
43 45 Resources used in the conversion process.
44 46
45 47 Returns
46 ----------
48 -------
47 49 tuple- output, resources, exporter_instance
48 50 output : str
49 51 Jinja 2 output. This is the resulting converted notebook.
@@ -55,6 +57,8 b' def DocDecorator(f):'
55 57 to caller because it provides a 'file_extension' property which
56 58 specifies what extension the output should be saved as.
57 59
60 Notes
61 -----
58 62 WARNING: API WILL CHANGE IN FUTURE RELEASES OF NBCONVERT
59 63 """
60 64
@@ -92,11 +96,13 b' def export(exporter, nb, **kw):'
92 96 """
93 97 Export a notebook object using specific exporter class.
94 98
95 exporter : Exporter class type or instance
96 Class type or instance of the exporter that should be used. If the
97 method initializes it's own instance of the class, it is ASSUMED that
98 the class type provided exposes a constructor (__init__) with the same
99 signature as the base Exporter class.
99 Parameters
100 ----------
101 exporter : class:`~IPython.nbconvert.exporters.exporter.Exporter` class or instance
102 Class type or instance of the exporter that should be used. If the
103 method initializes it's own instance of the class, it is ASSUMED that
104 the class type provided exposes a constructor (``__init__``) with the same
105 signature as the base Exporter class.
100 106 """
101 107
102 108 #Check arguments
@@ -152,6 +158,8 b' def export_by_name(format_name, nb, **kw):'
152 158 (Inspect) is used to find the template's corresponding explicit export
153 159 method defined in this module. That method is then called directly.
154 160
161 Parameters
162 ----------
155 163 format_name : str
156 164 Name of the template style to export to.
157 165 """
@@ -77,7 +77,7 b' nbconvert_flags.update({'
77 77
78 78
79 79 class NbConvertApp(BaseIPythonApplication):
80 """Application used to convert to and from notebook file type (*.ipynb)"""
80 """Application used to convert from notebook file type (``*.ipynb``)"""
81 81
82 82 name = 'ipython-nbconvert'
83 83 aliases = nbconvert_aliases
General Comments 0
You need to be logged in to leave comments. Login now