##// 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 warnings.warn("The module IPython.utils.warn is deprecated since IPython 4.0, use the standard warnings module instead", DeprecationWarning)
14 warnings.warn("The module IPython.utils.warn is deprecated since IPython 4.0, use the standard warnings module instead", DeprecationWarning)
15
15
16 def warn(msg,level=2,exit_val=1):
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 Output is sent to io.stderr (sys.stderr by default).
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 def info(msg):
44 def info(msg):
43 """Equivalent to warn(msg,level=1)."""
45 """Deprecated
46
47 Equivalent to warn(msg,level=1)."""
44
48
45 warn(msg,level=1)
49 warn(msg,level=1)
46
50
47
51
48 def error(msg):
52 def error(msg):
49 """Equivalent to warn(msg,level=3)."""
53 """Deprecated
54
55 Equivalent to warn(msg,level=3)."""
50
56
51 warn(msg,level=3)
57 warn(msg,level=3)
52
58
53
59
54 def fatal(msg,exit_val=1):
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 warn(msg,exit_val=exit_val,level=4)
65 warn(msg,exit_val=exit_val,level=4)
@@ -87,7 +87,7 b' source/api/generated/gen.txt:'
87 $(PYTHON) autogen_api.py
87 $(PYTHON) autogen_api.py
88 @echo "Build API docs finished."
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 $(PYTHON) autogen_shortcuts.py
91 $(PYTHON) autogen_shortcuts.py
92 @echo "Created docs for shortcuts"
92 @echo "Created docs for shortcuts"
93
93
@@ -54,6 +54,8 b" if __name__ == '__main__':"
54 r'\.nbformat',
54 r'\.nbformat',
55 r'\.parallel',
55 r'\.parallel',
56 r'\.qt',
56 r'\.qt',
57 # this is deprecated.
58 r'\.utils\.warn',
57 ]
59 ]
58 # main API is in the inputhook module, which is documented.
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 def name(c):
6 def name(c):
7 s = c.__class__.__name__
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 return log_filters[s] if s in log_filters.keys() else s
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 """Yield readable conditional filter
36 """Yield readable conditional filter
33 """
37 """
34 assert hasattr(flt, 'filters'), 'Conditional filter required'
38 assert hasattr(flt, 'filters'), 'Conditional filter required'
35
36 yield name(flt)
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 kbm = KeyBindingManager.for_prompt()
45 kbm = KeyBindingManager.for_prompt()
46 ipy_bindings = kbm.registry.key_bindings
46 ipy_bindings = kbm.registry.key_bindings
@@ -71,13 +71,15 b' for kb in ipy_bindings:'
71
71
72 if __name__ == '__main__':
72 if __name__ == '__main__':
73
73
74 sort_key = lambda k:(str(k[0][1]),str(k[0][0]))
75
74 here = abspath(dirname(__file__))
76 here = abspath(dirname(__file__))
75 dest = join(here, 'source', 'config', 'shortcuts')
77 dest = join(here, 'source', 'config', 'shortcuts')
76
78
77 with open(join(dest, 'single_filtered.csv'), 'w') as csv:
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 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
81 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
80
82
81 with open(join(dest, 'multi_filtered.csv'), 'w') as csv:
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 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
85 csv.write(':kbd:`{}`\t{}\t{}\n'.format(k[0], k[1], v))
@@ -4,6 +4,12 b' IPython shortcuts'
4
4
5 Available shortcut in IPython terminal.
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 Single Filtered shortcuts
14 Single Filtered shortcuts
9 =========================
15 =========================
General Comments 0
You need to be logged in to leave comments. Login now