##// END OF EJS Templates
Merge pull request #9680 from Carreau/improve-shortcut-docs...
Thomas Kluyver -
r22651:fb256d09 merge
parent child Browse files
Show More
@@ -14,7 +14,9 b' import warnings'
14 14 warnings.warn("The module IPython.utils.warn is deprecated since IPython 4.0, use the standard warnings module instead", DeprecationWarning)
15 15
16 16 def warn(msg,level=2,exit_val=1):
17 """Standard warning printer. Gives formatting consistency.
17 """Deprecated
18
19 Standard warning printer. Gives formatting consistency.
18 20
19 21 Output is sent to io.stderr (sys.stderr by default).
20 22
@@ -40,18 +42,24 b' def warn(msg,level=2,exit_val=1):'
40 42
41 43
42 44 def info(msg):
43 """Equivalent to warn(msg,level=1)."""
45 """Deprecated
46
47 Equivalent to warn(msg,level=1)."""
44 48
45 49 warn(msg,level=1)
46 50
47 51
48 52 def error(msg):
49 """Equivalent to warn(msg,level=3)."""
53 """Deprecated
54
55 Equivalent to warn(msg,level=3)."""
50 56
51 57 warn(msg,level=3)
52 58
53 59
54 60 def fatal(msg,exit_val=1):
55 """Equivalent to warn(msg,exit_val=exit_val,level=4)."""
61 """Deprecated
62
63 Equivalent to warn(msg,exit_val=exit_val,level=4)."""
56 64
57 65 warn(msg,exit_val=exit_val,level=4)
@@ -87,7 +87,7 b' source/api/generated/gen.txt:'
87 87 $(PYTHON) autogen_api.py
88 88 @echo "Build API docs finished."
89 89
90 autogen_shortcuts:
90 autogen_shortcuts: autogen_shortcuts.py ../IPython/terminal/interactiveshell.py source/config/shortcuts/index.rst
91 91 $(PYTHON) autogen_shortcuts.py
92 92 @echo "Created docs for shortcuts"
93 93
@@ -54,6 +54,8 b" if __name__ == '__main__':"
54 54 r'\.nbformat',
55 55 r'\.parallel',
56 56 r'\.qt',
57 # this is deprecated.
58 r'\.utils\.warn',
57 59 ]
58 60 # main API is in the inputhook module, which is documented.
59 61
@@ -5,6 +5,10 b' from IPython.terminal.interactiveshell import KeyBindingManager'
5 5
6 6 def name(c):
7 7 s = c.__class__.__name__
8 if s == '_Invert':
9 return '(Not: %s)' % name(c.filter)
10 if s in log_filters.keys():
11 return '(%s: %s)' % (log_filters[s], ', '.join(name(x) for x in c.filters))
8 12 return log_filters[s] if s in log_filters.keys() else s
9 13
10 14
@@ -32,15 +36,11 b' def multi_filter_str(flt):'
32 36 """Yield readable conditional filter
33 37 """
34 38 assert hasattr(flt, 'filters'), 'Conditional filter required'
35
36 39 yield name(flt)
37 for subfilter in flt.filters:
38 yield name(subfilter)
39 if hasattr(subfilter, 'filter'):
40 yield name(subfilter.filter)
41 40
42 41
43 log_filters = dict(_AndList='(And)', _OrList='(Or)', _Invert='(Inv)')
42 log_filters = dict(_AndList='And', _OrList='Or')
43 log_invert = {'_Invert'}
44 44
45 45 kbm = KeyBindingManager.for_prompt()
46 46 ipy_bindings = kbm.registry.key_bindings
@@ -71,13 +71,15 b' for kb in ipy_bindings:'
71 71
72 72 if __name__ == '__main__':
73 73
74 sort_key = lambda k:(str(k[0][1]),str(k[0][0]))
75
74 76 here = abspath(dirname(__file__))
75 77 dest = join(here, 'source', 'config', 'shortcuts')
76 78
77 79 with open(join(dest, 'single_filtered.csv'), 'w') as csv:
78 for k, v in sorted(single_filter.items()):
80 for k, v in sorted(single_filter.items(), key=sort_key):
79 81 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
80 82
81 83 with open(join(dest, 'multi_filtered.csv'), 'w') as csv:
82 for k, v in sorted(multi_filter.items()):
84 for k, v in sorted(multi_filter.items(), key=sort_key):
83 85 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
@@ -4,6 +4,12 b' IPython shortcuts'
4 4
5 5 Available shortcut in IPython terminal.
6 6
7 .. warning::
8
9 This list is automatically generated, and may not hold all the available
10 shortcut. In particular, it may depends on the version of ``prompt_toolkit``
11 installed during the generation of this page.
12
7 13
8 14 Single Filtered shortcuts
9 15 =========================
General Comments 0
You need to be logged in to leave comments. Login now