Skip to content

Commit 666fdfa

Browse files
committed
Miscellaneous docs fixes
1 parent 1a5daaa commit 666fdfa

File tree

22 files changed

+106
-100
lines changed

22 files changed

+106
-100
lines changed

IPython/core/debugger.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def __call__(self):
162162

163163
def decorate_fn_with_doc(new_fn, old_fn, additional_text=""):
164164
"""Make new_fn have old_fn's doc string. This is particularly useful
165-
for the do_... commands that hook into the help system.
165+
for the ``do_...`` commands that hook into the help system.
166166
Adapted from from a comp.lang.python posting
167167
by Duncan Booth."""
168168
def wrapper(*args, **kw):

IPython/core/hooks.py

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,31 @@
1-
"""hooks for IPython.
1+
"""Hooks for IPython.
22
33
In Python, it is possible to overwrite any method of any object if you really
4-
want to. But IPython exposes a few 'hooks', methods which are _designed_ to
4+
want to. But IPython exposes a few 'hooks', methods which are *designed* to
55
be overwritten by users for customization purposes. This module defines the
66
default versions of all such hooks, which get used by IPython if not
77
overridden by the user.
88
9-
hooks are simple functions, but they should be declared with 'self' as their
9+
Hooks are simple functions, but they should be declared with ``self`` as their
1010
first argument, because when activated they are registered into IPython as
11-
instance methods. The self argument will be the IPython running instance
11+
instance methods. The self argument will be the IPython running instance
1212
itself, so hooks have full access to the entire IPython object.
1313
14-
If you wish to define a new hook and activate it, you need to put the
15-
necessary code into a python file which can be either imported or execfile()'d
16-
from within your profile's ipython_config.py configuration.
14+
If you wish to define a new hook and activate it, you can make an :doc:`extension
15+
</config/extensions/index>` or a :ref:`startup script <startup_files>`. For
16+
example, you could use a startup file like this::
1717
18-
For example, suppose that you have a module called 'myiphooks' in your
19-
PYTHONPATH, which contains the following definition:
18+
import os
2019
21-
import os
22-
from IPython.core import ipapi
23-
ip = ipapi.get()
24-
25-
def calljed(self,filename, linenum):
26-
"My editor hook calls the jed editor directly."
27-
print "Calling my own editor, jed ..."
28-
if os.system('jed +%d %s' % (linenum,filename)) != 0:
29-
raise TryNext()
20+
def calljed(self,filename, linenum):
21+
"My editor hook calls the jed editor directly."
22+
print "Calling my own editor, jed ..."
23+
if os.system('jed +%d %s' % (linenum,filename)) != 0:
24+
raise TryNext()
3025
31-
ip.set_hook('editor', calljed)
26+
def load_ipython_extension(ip):
27+
ip.set_hook('editor', calljed)
3228
33-
You can then enable the functionality by doing 'import myiphooks'
34-
somewhere in your configuration files or ipython command line.
3529
"""
3630

3731
#*****************************************************************************

IPython/core/interactiveshell.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,10 +1902,10 @@ def set_next_input(self, s):
19021902
19031903
Requires readline.
19041904
1905-
Example:
1905+
Example::
19061906
1907-
[D:\ipython]|1> _ip.set_next_input("Hello Word")
1908-
[D:\ipython]|2> Hello Word_ # cursor is here
1907+
In [1]: _ip.set_next_input("Hello Word")
1908+
In [2]: Hello Word_ # cursor is here
19091909
"""
19101910
self.rl_next_input = py3compat.cast_bytes_py2(s)
19111911

@@ -2828,12 +2828,11 @@ def enable_pylab(self, gui=None, import_all=True, welcome_message=False):
28282828
This turns on support for matplotlib, preloads into the interactive
28292829
namespace all of numpy and pylab, and configures IPython to correctly
28302830
interact with the GUI event loop. The GUI backend to be used can be
2831-
optionally selected with the optional :param:`gui` argument.
2831+
optionally selected with the optional ``gui`` argument.
28322832
28332833
Parameters
28342834
----------
28352835
gui : optional, string
2836-
28372836
If given, dictates the choice of matplotlib GUI backend to use
28382837
(should be one of IPython's supported backends, 'qt', 'osx', 'tk',
28392838
'gtk', 'wx' or 'inline'), otherwise we use the default chosen by

IPython/core/magics/history.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,19 @@ def history(self, parameter_s = ''):
105105
106106
By default, all input history from the current session is displayed.
107107
Ranges of history can be indicated using the syntax:
108-
4 : Line 4, current session
109-
4-6 : Lines 4-6, current session
110-
243/1-5: Lines 1-5, session 243
111-
~2/7 : Line 7, session 2 before current
112-
~8/1-~6/5 : From the first line of 8 sessions ago, to the fifth line
113-
of 6 sessions ago.
108+
109+
``4``
110+
Line 4, current session
111+
``4-6``
112+
Lines 4-6, current session
113+
``243/1-5``
114+
Lines 1-5, session 243
115+
``~2/7``
116+
Line 7, session 2 before current
117+
``~8/1-~6/5``
118+
From the first line of 8 sessions ago, to the fifth line of 6
119+
sessions ago.
120+
114121
Multiple ranges can be entered, separated by spaces
115122
116123
The same syntax is used by %macro, %save, %edit, %rerun

IPython/core/payloadpage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def page(strng, start=0, screen_lines=0, pager_cmd=None,
5757
converted to HTML with docutils. Note that if docutils is not found,
5858
this option is silently ignored.
5959
60-
Note
61-
----
60+
Notes
61+
-----
6262
6363
Only one of the ``html`` and ``auto_html`` options can be given, not
6464
both.

IPython/core/ultratb.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ def structured_traceback(self, etype, evalue, tb, tb_offset=None,
420420
class ListTB(TBTools):
421421
"""Print traceback information from a traceback list, with optional color.
422422
423-
Calling: requires 3 arguments:
424-
(etype, evalue, elist)
425-
as would be obtained by:
423+
Calling requires 3 arguments: (etype, evalue, elist)
424+
as would be obtained by::
425+
426426
etype, evalue, tb = sys.exc_info()
427427
if tb:
428428
elist = traceback.extract_tb(tb)
@@ -1130,13 +1130,13 @@ class AutoFormattedTB(FormattedTB):
11301130
11311131
It will find out about exceptions by itself.
11321132
1133-
A brief example:
1133+
A brief example::
11341134
1135-
AutoTB = AutoFormattedTB(mode = 'Verbose',color_scheme='Linux')
1136-
try:
1137-
...
1138-
except:
1139-
AutoTB() # or AutoTB(out=logfile) where logfile is an open file object
1135+
AutoTB = AutoFormattedTB(mode = 'Verbose',color_scheme='Linux')
1136+
try:
1137+
...
1138+
except:
1139+
AutoTB() # or AutoTB(out=logfile) where logfile is an open file object
11401140
"""
11411141

11421142
def __call__(self,etype=None,evalue=None,etb=None,

IPython/lib/display.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ class FileLink(object):
5959
6060
e.g. to embed a link that was generated in the IPython notebook as my/data.txt
6161
62-
you would do:
62+
you would do::
6363
64-
local_file = FileLink("my/data.txt")
65-
display(local_file)
64+
local_file = FileLink("my/data.txt")
65+
display(local_file)
6666
67-
or in the HTML notebook, just
67+
or in the HTML notebook, just::
6868
69-
FileLink("my/data.txt")
69+
FileLink("my/data.txt")
7070
"""
7171

7272
html_link_str = "<a href='%s' target='_blank'>%s</a>"
@@ -77,13 +77,17 @@ def __init__(self,
7777
result_html_prefix='',
7878
result_html_suffix='<br>'):
7979
"""
80-
path : path to the file or directory that should be formatted
81-
directory_prefix : prefix to be prepended to all files to form a
82-
working link [default: 'files']
83-
result_html_prefix : text to append to beginning to link
84-
[default: none]
85-
result_html_suffix : text to append at the end of link
86-
[default: '<br>']
80+
Parameters
81+
----------
82+
path : str
83+
path to the file or directory that should be formatted
84+
directory_prefix : str
85+
prefix to be prepended to all files to form a working link [default:
86+
'files']
87+
result_html_prefix : str
88+
text to append to beginning to link [default: none]
89+
result_html_suffix : str
90+
text to append at the end of link [default: '<br>']
8791
"""
8892
if isdir(path):
8993
raise ValueError,\

IPython/lib/inputhook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ def enable_gui(gui=None, app=None):
500500
For toolkits that have the concept of a global app, you can supply an
501501
existing one. If not given, the toolkit will be probed for one, and if
502502
none is found, a new one will be created. Note that GTK does not have
503-
this concept, and passing an app if `gui`=="GTK" will raise an error.
503+
this concept, and passing an app if ``gui=="GTK"`` will raise an error.
504504
505505
Returns
506506
-------

IPython/testing/decorators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ def skipif(skip_condition, msg=None):
183183
Parameters
184184
----------
185185
skip_condition : bool or callable.
186-
Flag to determine whether to skip test. If the condition is a
187-
callable, it is used at runtime to dynamically make the decision. This
188-
is useful for tests that may require costly imports, to delay the cost
189-
until the test suite is actually executed.
186+
Flag to determine whether to skip test. If the condition is a
187+
callable, it is used at runtime to dynamically make the decision. This
188+
is useful for tests that may require costly imports, to delay the cost
189+
until the test suite is actually executed.
190190
msg : string
191191
Message to give on raising a SkipTest exception
192192

IPython/testing/tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def parse_test_output(txt):
9797
txt : str
9898
Text output of a test run, assumed to contain a line of one of the
9999
following forms::
100+
100101
'FAILED (errors=1)'
101102
'FAILED (failures=1)'
102103
'FAILED (errors=1, failures=1)'

0 commit comments

Comments
 (0)