Show More
@@ -16,58 +16,6 b' import os,sys' | |||
|
16 | 16 | |
|
17 | 17 | from IPython.genutils import * |
|
18 | 18 | |
|
19 | # use ? | |
|
20 | def magic_pdef(self, parameter_s='', namespaces=None): | |
|
21 | """Print the definition header for any callable object. | |
|
22 | ||
|
23 | If the object is a class, print the constructor information.""" | |
|
24 | self._inspect('pdef',parameter_s, namespaces) | |
|
25 | ||
|
26 | ip.expose_magic("pdef", magic_pdef) | |
|
27 | ||
|
28 | # use ? | |
|
29 | def magic_pdoc(self, parameter_s='', namespaces=None): | |
|
30 | """Print the docstring for an object. | |
|
31 | ||
|
32 | If the given object is a class, it will print both the class and the | |
|
33 | constructor docstrings.""" | |
|
34 | self._inspect('pdoc',parameter_s, namespaces) | |
|
35 | ||
|
36 | ip.expose_magic("pdoc", magic_pdoc) | |
|
37 | ||
|
38 | # use ?? | |
|
39 | def magic_psource(self, parameter_s='', namespaces=None): | |
|
40 | """Print (or run through pager) the source code for an object.""" | |
|
41 | self._inspect('psource',parameter_s, namespaces) | |
|
42 | ||
|
43 | ip.expose_magic("pdoc", magic_psource) | |
|
44 | ||
|
45 | # use ? | |
|
46 | def magic_pfile(self, parameter_s=''): | |
|
47 | """Print (or run through pager) the file where an object is defined. | |
|
48 | ||
|
49 | The file opens at the line where the object definition begins. IPython | |
|
50 | will honor the environment variable PAGER if set, and otherwise will | |
|
51 | do its best to print the file in a convenient form. | |
|
52 | ||
|
53 | If the given argument is not an object currently defined, IPython will | |
|
54 | try to interpret it as a filename (automatically adding a .py extension | |
|
55 | if needed). You can thus use %pfile as a syntax highlighting code | |
|
56 | viewer.""" | |
|
57 | ||
|
58 | # first interpret argument as an object name | |
|
59 | out = self._inspect('pfile',parameter_s) | |
|
60 | # if not, try the input as a filename | |
|
61 | if out == 'not found': | |
|
62 | try: | |
|
63 | filename = get_py_filename(parameter_s) | |
|
64 | except IOError,msg: | |
|
65 | print msg | |
|
66 | return | |
|
67 | page(self.shell.inspector.format(file(filename).read())) | |
|
68 | ||
|
69 | ip.expose_magic("pfile", magic_pfile) | |
|
70 | ||
|
71 | 19 | # use rehashx |
|
72 | 20 | |
|
73 | 21 | def magic_rehash(self, parameter_s = ''): |
@@ -97,40 +45,6 b" def magic_rehash(self, parameter_s = ''):" | |||
|
97 | 45 | |
|
98 | 46 | ip.expose_magic("rehash", magic_rehash) |
|
99 | 47 | |
|
100 | #use cd -<tab> | |
|
101 | def magic_dhist(self, parameter_s=''): | |
|
102 | """Print your history of visited directories. | |
|
103 | ||
|
104 | %dhist -> print full history\\ | |
|
105 | %dhist n -> print last n entries only\\ | |
|
106 | %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\ | |
|
107 | ||
|
108 | This history is automatically maintained by the %cd command, and | |
|
109 | always available as the global list variable _dh. You can use %cd -<n> | |
|
110 | to go to directory number <n>.""" | |
|
111 | ||
|
112 | dh = self.shell.user_ns['_dh'] | |
|
113 | if parameter_s: | |
|
114 | try: | |
|
115 | args = map(int,parameter_s.split()) | |
|
116 | except: | |
|
117 | self.arg_err(Magic.magic_dhist) | |
|
118 | return | |
|
119 | if len(args) == 1: | |
|
120 | ini,fin = max(len(dh)-(args[0]),0),len(dh) | |
|
121 | elif len(args) == 2: | |
|
122 | ini,fin = args | |
|
123 | else: | |
|
124 | self.arg_err(Magic.magic_dhist) | |
|
125 | return | |
|
126 | else: | |
|
127 | ini,fin = 0,len(dh) | |
|
128 | nlprint(dh, | |
|
129 | header = 'Directory history (kept in _dh)', | |
|
130 | start=ini,stop=fin) | |
|
131 | ||
|
132 | ip.expose_magic("dhist", magic_dhist) | |
|
133 | ||
|
134 | 48 | # Exit |
|
135 | 49 | def magic_Quit(self, parameter_s=''): |
|
136 | 50 | """Exit IPython without confirmation (like %Exit).""" |
@@ -146,107 +60,3 b" def magic_p(self, parameter_s=''):" | |||
|
146 | 60 | exec 'print ' + parameter_s in self.shell.user_ns |
|
147 | 61 | |
|
148 | 62 | ip.expose_magic("p", magic_p) |
|
149 | ||
|
150 | # up + enter. One char magic. | |
|
151 | def magic_r(self, parameter_s=''): | |
|
152 | """Repeat previous input. | |
|
153 | ||
|
154 | If given an argument, repeats the previous command which starts with | |
|
155 | the same string, otherwise it just repeats the previous input. | |
|
156 | ||
|
157 | Shell escaped commands (with ! as first character) are not recognized | |
|
158 | by this system, only pure python code and magic commands. | |
|
159 | """ | |
|
160 | ||
|
161 | start = parameter_s.strip() | |
|
162 | esc_magic = self.shell.ESC_MAGIC | |
|
163 | # Identify magic commands even if automagic is on (which means | |
|
164 | # the in-memory version is different from that typed by the user). | |
|
165 | if self.shell.rc.automagic: | |
|
166 | start_magic = esc_magic+start | |
|
167 | else: | |
|
168 | start_magic = start | |
|
169 | # Look through the input history in reverse | |
|
170 | for n in range(len(self.shell.input_hist)-2,0,-1): | |
|
171 | input = self.shell.input_hist[n] | |
|
172 | # skip plain 'r' lines so we don't recurse to infinity | |
|
173 | if input != '_ip.magic("r")\n' and \ | |
|
174 | (input.startswith(start) or input.startswith(start_magic)): | |
|
175 | #print 'match',`input` # dbg | |
|
176 | print 'Executing:',input, | |
|
177 | self.shell.runlines(input) | |
|
178 | return | |
|
179 | print 'No previous input matching `%s` found.' % start | |
|
180 | ||
|
181 | ip.expose_magic("r", magic_r) | |
|
182 | ||
|
183 | ||
|
184 | # use _ip.option.automagic | |
|
185 | ||
|
186 | def magic_automagic(self, parameter_s = ''): | |
|
187 | """Make magic functions callable without having to type the initial %. | |
|
188 | ||
|
189 | Without argumentsl toggles on/off (when off, you must call it as | |
|
190 | %automagic, of course). With arguments it sets the value, and you can | |
|
191 | use any of (case insensitive): | |
|
192 | ||
|
193 | - on,1,True: to activate | |
|
194 | ||
|
195 | - off,0,False: to deactivate. | |
|
196 | ||
|
197 | Note that magic functions have lowest priority, so if there's a | |
|
198 | variable whose name collides with that of a magic fn, automagic won't | |
|
199 | work for that function (you get the variable instead). However, if you | |
|
200 | delete the variable (del var), the previously shadowed magic function | |
|
201 | becomes visible to automagic again.""" | |
|
202 | ||
|
203 | rc = self.shell.rc | |
|
204 | arg = parameter_s.lower() | |
|
205 | if parameter_s in ('on','1','true'): | |
|
206 | rc.automagic = True | |
|
207 | elif parameter_s in ('off','0','false'): | |
|
208 | rc.automagic = False | |
|
209 | else: | |
|
210 | rc.automagic = not rc.automagic | |
|
211 | print '\n' + Magic.auto_status[rc.automagic] | |
|
212 | ||
|
213 | ip.expose_magic("automagic", magic_automagic) | |
|
214 | ||
|
215 | # use _ip.options.autocall | |
|
216 | def magic_autocall(self, parameter_s = ''): | |
|
217 | """Make functions callable without having to type parentheses. | |
|
218 | ||
|
219 | Usage: | |
|
220 | ||
|
221 | %autocall [mode] | |
|
222 | ||
|
223 | The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the | |
|
224 | value is toggled on and off (remembering the previous state).""" | |
|
225 | ||
|
226 | rc = self.shell.rc | |
|
227 | ||
|
228 | if parameter_s: | |
|
229 | arg = int(parameter_s) | |
|
230 | else: | |
|
231 | arg = 'toggle' | |
|
232 | ||
|
233 | if not arg in (0,1,2,'toggle'): | |
|
234 | error('Valid modes: (0->Off, 1->Smart, 2->Full') | |
|
235 | return | |
|
236 | ||
|
237 | if arg in (0,1,2): | |
|
238 | rc.autocall = arg | |
|
239 | else: # toggle | |
|
240 | if rc.autocall: | |
|
241 | self._magic_state.autocall_save = rc.autocall | |
|
242 | rc.autocall = 0 | |
|
243 | else: | |
|
244 | try: | |
|
245 | rc.autocall = self._magic_state.autocall_save | |
|
246 | except AttributeError: | |
|
247 | rc.autocall = self._magic_state.autocall_save = 1 | |
|
248 | ||
|
249 | print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall] | |
|
250 | ||
|
251 | ip.expose_magic("autocall", magic_autocall) | |
|
252 |
@@ -5,7 +5,7 b' Class which mimics a module.' | |||
|
5 | 5 | Needed to allow pickle to correctly resolve namespaces during IPython |
|
6 | 6 | sessions. |
|
7 | 7 | |
|
8 |
$Id: FakeModule.py 2 |
|
|
8 | $Id: FakeModule.py 2723 2007-09-07 07:44:16Z fperez $""" | |
|
9 | 9 | |
|
10 | 10 | #***************************************************************************** |
|
11 | 11 | # Copyright (C) 2002-2004 Fernando Perez. <fperez@colorado.edu> |
@@ -14,7 +14,9 b' $Id: FakeModule.py 2169 2007-03-23 06:09:43Z fperez $"""' | |||
|
14 | 14 | # the file COPYING, distributed as part of this software. |
|
15 | 15 | #***************************************************************************** |
|
16 | 16 | |
|
17 | class FakeModule: | |
|
17 | import types | |
|
18 | ||
|
19 | class FakeModule(types.ModuleType): | |
|
18 | 20 | """Simple class with attribute access to fake a module. |
|
19 | 21 | |
|
20 | 22 | This is not meant to replace a module, but to allow inserting a fake |
@@ -23,7 +25,6 b' class FakeModule:' | |||
|
23 | 25 | sessions. |
|
24 | 26 | |
|
25 | 27 | Do NOT use this code for anything other than this IPython private hack.""" |
|
26 | ||
|
27 | 28 | def __init__(self,adict): |
|
28 | 29 | |
|
29 | 30 | # It seems pydoc (and perhaps others) needs any module instance to |
@@ -33,14 +34,14 b' class FakeModule:' | |||
|
33 | 34 | return 1 |
|
34 | 35 | adict['__nonzero__'] = __nonzero__ |
|
35 | 36 | |
|
36 |
self. |
|
|
37 | self._dict_ = adict | |
|
37 | 38 | |
|
38 | 39 | # modules should have a __file__ attribute |
|
39 | 40 | adict.setdefault('__file__',__file__) |
|
40 | 41 | |
|
41 | 42 | def __getattr__(self,key): |
|
42 | 43 | try: |
|
43 |
return self. |
|
|
44 | return self._dict_[key] | |
|
44 | 45 | except KeyError, e: |
|
45 | 46 | raise AttributeError("FakeModule object has no attribute %s" % e) |
|
46 | 47 |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | |
|
4 |
$Id: Magic.py 27 |
|
|
4 | $Id: Magic.py 2723 2007-09-07 07:44:16Z fperez $""" | |
|
5 | 5 | |
|
6 | 6 | #***************************************************************************** |
|
7 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -476,6 +476,100 b' Currently the magic system has the following functions:\\n"""' | |||
|
476 | 476 | self.shell.set_autoindent() |
|
477 | 477 | print "Automatic indentation is:",['OFF','ON'][self.shell.autoindent] |
|
478 | 478 | |
|
479 | ||
|
480 | def magic_automagic(self, parameter_s = ''): | |
|
481 | """Make magic functions callable without having to type the initial %. | |
|
482 | ||
|
483 | Without argumentsl toggles on/off (when off, you must call it as | |
|
484 | %automagic, of course). With arguments it sets the value, and you can | |
|
485 | use any of (case insensitive): | |
|
486 | ||
|
487 | - on,1,True: to activate | |
|
488 | ||
|
489 | - off,0,False: to deactivate. | |
|
490 | ||
|
491 | Note that magic functions have lowest priority, so if there's a | |
|
492 | variable whose name collides with that of a magic fn, automagic won't | |
|
493 | work for that function (you get the variable instead). However, if you | |
|
494 | delete the variable (del var), the previously shadowed magic function | |
|
495 | becomes visible to automagic again.""" | |
|
496 | ||
|
497 | rc = self.shell.rc | |
|
498 | arg = parameter_s.lower() | |
|
499 | if parameter_s in ('on','1','true'): | |
|
500 | rc.automagic = True | |
|
501 | elif parameter_s in ('off','0','false'): | |
|
502 | rc.automagic = False | |
|
503 | else: | |
|
504 | rc.automagic = not rc.automagic | |
|
505 | print '\n' + Magic.auto_status[rc.automagic] | |
|
506 | ||
|
507 | ||
|
508 | def magic_autocall(self, parameter_s = ''): | |
|
509 | """Make functions callable without having to type parentheses. | |
|
510 | ||
|
511 | Usage: | |
|
512 | ||
|
513 | %autocall [mode] | |
|
514 | ||
|
515 | The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the | |
|
516 | value is toggled on and off (remembering the previous state). | |
|
517 | ||
|
518 | In more detail, these values mean: | |
|
519 | ||
|
520 | 0 -> fully disabled | |
|
521 | ||
|
522 | 1 -> active, but do not apply if there are no arguments on the line. | |
|
523 | ||
|
524 | In this mode, you get: | |
|
525 | ||
|
526 | In [1]: callable | |
|
527 | Out[1]: <built-in function callable> | |
|
528 | ||
|
529 | In [2]: callable 'hello' | |
|
530 | ------> callable('hello') | |
|
531 | Out[2]: False | |
|
532 | ||
|
533 | 2 -> Active always. Even if no arguments are present, the callable | |
|
534 | object is called: | |
|
535 | ||
|
536 | In [4]: callable | |
|
537 | ------> callable() | |
|
538 | ||
|
539 | Note that even with autocall off, you can still use '/' at the start of | |
|
540 | a line to treat the first argument on the command line as a function | |
|
541 | and add parentheses to it: | |
|
542 | ||
|
543 | In [8]: /str 43 | |
|
544 | ------> str(43) | |
|
545 | Out[8]: '43' | |
|
546 | """ | |
|
547 | ||
|
548 | rc = self.shell.rc | |
|
549 | ||
|
550 | if parameter_s: | |
|
551 | arg = int(parameter_s) | |
|
552 | else: | |
|
553 | arg = 'toggle' | |
|
554 | ||
|
555 | if not arg in (0,1,2,'toggle'): | |
|
556 | error('Valid modes: (0->Off, 1->Smart, 2->Full') | |
|
557 | return | |
|
558 | ||
|
559 | if arg in (0,1,2): | |
|
560 | rc.autocall = arg | |
|
561 | else: # toggle | |
|
562 | if rc.autocall: | |
|
563 | self._magic_state.autocall_save = rc.autocall | |
|
564 | rc.autocall = 0 | |
|
565 | else: | |
|
566 | try: | |
|
567 | rc.autocall = self._magic_state.autocall_save | |
|
568 | except AttributeError: | |
|
569 | rc.autocall = self._magic_state.autocall_save = 1 | |
|
570 | ||
|
571 | print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall] | |
|
572 | ||
|
479 | 573 | def magic_system_verbose(self, parameter_s = ''): |
|
480 | 574 | """Set verbose printing of system calls. |
|
481 | 575 | |
@@ -544,7 +638,47 b' Currently the magic system has the following functions:\\n"""' | |||
|
544 | 638 | else: |
|
545 | 639 | self._inspect('pinfo', oname, detail_level=detail_level, |
|
546 | 640 | namespaces=namespaces) |
|
547 | ||
|
641 | ||
|
642 | def magic_pdef(self, parameter_s='', namespaces=None): | |
|
643 | """Print the definition header for any callable object. | |
|
644 | ||
|
645 | If the object is a class, print the constructor information.""" | |
|
646 | self._inspect('pdef',parameter_s, namespaces) | |
|
647 | ||
|
648 | def magic_pdoc(self, parameter_s='', namespaces=None): | |
|
649 | """Print the docstring for an object. | |
|
650 | ||
|
651 | If the given object is a class, it will print both the class and the | |
|
652 | constructor docstrings.""" | |
|
653 | self._inspect('pdoc',parameter_s, namespaces) | |
|
654 | ||
|
655 | def magic_psource(self, parameter_s='', namespaces=None): | |
|
656 | """Print (or run through pager) the source code for an object.""" | |
|
657 | self._inspect('psource',parameter_s, namespaces) | |
|
658 | ||
|
659 | def magic_pfile(self, parameter_s=''): | |
|
660 | """Print (or run through pager) the file where an object is defined. | |
|
661 | ||
|
662 | The file opens at the line where the object definition begins. IPython | |
|
663 | will honor the environment variable PAGER if set, and otherwise will | |
|
664 | do its best to print the file in a convenient form. | |
|
665 | ||
|
666 | If the given argument is not an object currently defined, IPython will | |
|
667 | try to interpret it as a filename (automatically adding a .py extension | |
|
668 | if needed). You can thus use %pfile as a syntax highlighting code | |
|
669 | viewer.""" | |
|
670 | ||
|
671 | # first interpret argument as an object name | |
|
672 | out = self._inspect('pfile',parameter_s) | |
|
673 | # if not, try the input as a filename | |
|
674 | if out == 'not found': | |
|
675 | try: | |
|
676 | filename = get_py_filename(parameter_s) | |
|
677 | except IOError,msg: | |
|
678 | print msg | |
|
679 | return | |
|
680 | page(self.shell.inspector.format(file(filename).read())) | |
|
681 | ||
|
548 | 682 | def _inspect(self,meth,oname,namespaces=None,**kw): |
|
549 | 683 | """Generic interface to the inspector system. |
|
550 | 684 | |
@@ -2566,6 +2700,38 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2566 | 2700 | |
|
2567 | 2701 | return self.shell.dir_stack[:] |
|
2568 | 2702 | |
|
2703 | def magic_dhist(self, parameter_s=''): | |
|
2704 | """Print your history of visited directories. | |
|
2705 | ||
|
2706 | %dhist -> print full history\\ | |
|
2707 | %dhist n -> print last n entries only\\ | |
|
2708 | %dhist n1 n2 -> print entries between n1 and n2 (n1 not included)\\ | |
|
2709 | ||
|
2710 | This history is automatically maintained by the %cd command, and | |
|
2711 | always available as the global list variable _dh. You can use %cd -<n> | |
|
2712 | to go to directory number <n>.""" | |
|
2713 | ||
|
2714 | dh = self.shell.user_ns['_dh'] | |
|
2715 | if parameter_s: | |
|
2716 | try: | |
|
2717 | args = map(int,parameter_s.split()) | |
|
2718 | except: | |
|
2719 | self.arg_err(Magic.magic_dhist) | |
|
2720 | return | |
|
2721 | if len(args) == 1: | |
|
2722 | ini,fin = max(len(dh)-(args[0]),0),len(dh) | |
|
2723 | elif len(args) == 2: | |
|
2724 | ini,fin = args | |
|
2725 | else: | |
|
2726 | self.arg_err(Magic.magic_dhist) | |
|
2727 | return | |
|
2728 | else: | |
|
2729 | ini,fin = 0,len(dh) | |
|
2730 | nlprint(dh, | |
|
2731 | header = 'Directory history (kept in _dh)', | |
|
2732 | start=ini,stop=fin) | |
|
2733 | ||
|
2734 | ||
|
2569 | 2735 | def magic_sc(self, parameter_s=''): |
|
2570 | 2736 | """Shell capture - execute a shell command and capture its output. |
|
2571 | 2737 | |
@@ -2769,6 +2935,36 b' Defaulting color scheme to \'NoColor\'"""' | |||
|
2769 | 2935 | |
|
2770 | 2936 | self.shell.jobs.new(parameter_s,self.shell.user_ns) |
|
2771 | 2937 | |
|
2938 | def magic_r(self, parameter_s=''): | |
|
2939 | """Repeat previous input. | |
|
2940 | ||
|
2941 | If given an argument, repeats the previous command which starts with | |
|
2942 | the same string, otherwise it just repeats the previous input. | |
|
2943 | ||
|
2944 | Shell escaped commands (with ! as first character) are not recognized | |
|
2945 | by this system, only pure python code and magic commands. | |
|
2946 | """ | |
|
2947 | ||
|
2948 | start = parameter_s.strip() | |
|
2949 | esc_magic = self.shell.ESC_MAGIC | |
|
2950 | # Identify magic commands even if automagic is on (which means | |
|
2951 | # the in-memory version is different from that typed by the user). | |
|
2952 | if self.shell.rc.automagic: | |
|
2953 | start_magic = esc_magic+start | |
|
2954 | else: | |
|
2955 | start_magic = start | |
|
2956 | # Look through the input history in reverse | |
|
2957 | for n in range(len(self.shell.input_hist)-2,0,-1): | |
|
2958 | input = self.shell.input_hist[n] | |
|
2959 | # skip plain 'r' lines so we don't recurse to infinity | |
|
2960 | if input != '_ip.magic("r")\n' and \ | |
|
2961 | (input.startswith(start) or input.startswith(start_magic)): | |
|
2962 | #print 'match',`input` # dbg | |
|
2963 | print 'Executing:',input, | |
|
2964 | self.shell.runlines(input) | |
|
2965 | return | |
|
2966 | print 'No previous input matching `%s` found.' % start | |
|
2967 | ||
|
2772 | 2968 | |
|
2773 | 2969 | def magic_bookmark(self, parameter_s=''): |
|
2774 | 2970 | """Manage IPython's bookmark system. |
@@ -6,7 +6,7 b' Uses syntax highlighting for presenting the various information elements.' | |||
|
6 | 6 | Similar in spirit to the inspect module, but all calls take a name argument to |
|
7 | 7 | reference the name under which an object is being read. |
|
8 | 8 | |
|
9 |
$Id: OInspect.py 27 |
|
|
9 | $Id: OInspect.py 2723 2007-09-07 07:44:16Z fperez $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -238,8 +238,7 b' class Inspector:' | |||
|
238 | 238 | if inspect.isclass(obj): |
|
239 | 239 | header = self.__head('Class constructor information:\n') |
|
240 | 240 | obj = obj.__init__ |
|
241 |
elif type(obj) is types.InstanceType |
|
|
242 | isinstance(obj,object): | |
|
241 | elif type(obj) is types.InstanceType: | |
|
243 | 242 | obj = obj.__call__ |
|
244 | 243 | |
|
245 | 244 | output = self.__getdef(obj,oname) |
@@ -408,8 +407,7 b' class Inspector:' | |||
|
408 | 407 | fname = inspect.getabsfile(obj) |
|
409 | 408 | if fname.endswith('<string>'): |
|
410 | 409 | fname = 'Dynamically generated function. No source code available.' |
|
411 |
if (fname.endswith('.so') or fname.endswith('.dll') |
|
|
412 | not os.path.isfile(fname)): | |
|
410 | if (fname.endswith('.so') or fname.endswith('.dll')): | |
|
413 | 411 | binary_file = True |
|
414 | 412 | out.writeln(header('File:\t\t')+fname) |
|
415 | 413 | except: |
@@ -426,11 +424,11 b' class Inspector:' | |||
|
426 | 424 | # avoid repetitions). If source fails, we add them back, see below. |
|
427 | 425 | if ds and detail_level == 0: |
|
428 | 426 | out.writeln(header('Docstring:\n') + indent(ds)) |
|
429 | ||
|
430 | 427 | |
|
431 | 428 | # Original source code for any callable |
|
432 | 429 | if detail_level: |
|
433 |
# Flush the source cache because inspect can return out-of-date |
|
|
430 | # Flush the source cache because inspect can return out-of-date | |
|
431 | # source | |
|
434 | 432 | linecache.checkcache() |
|
435 | 433 | source_success = False |
|
436 | 434 | try: |
@@ -6,7 +6,7 b' Requires Python 2.1 or better.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains the main make_IPython() starter function. |
|
8 | 8 | |
|
9 |
$Id: ipmaker.py 27 |
|
|
9 | $Id: ipmaker.py 2723 2007-09-07 07:44:16Z fperez $""" | |
|
10 | 10 | |
|
11 | 11 | #***************************************************************************** |
|
12 | 12 | # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu> |
@@ -112,7 +112,7 b' def make_IPython(argv=None,user_ns=None,user_global_ns=None,debug=1,' | |||
|
112 | 112 | "IPython %s -- An enhanced Interactive Python." |
|
113 | 113 | % (__version__,), |
|
114 | 114 | """\ |
|
115 |
? -> Introduction |
|
|
115 | ? -> Introduction and overview of IPython's features. | |
|
116 | 116 | %quickref -> Quick reference. |
|
117 | 117 | help -> Python's own help system. |
|
118 | 118 | object? -> Details about 'object'. ?object also works, ?? prints more. |
@@ -6,7 +6,7 b'' | |||
|
6 | 6 | # the file COPYING, distributed as part of this software. |
|
7 | 7 | #***************************************************************************** |
|
8 | 8 | |
|
9 |
# $Id: usage.py 27 |
|
|
9 | # $Id: usage.py 2723 2007-09-07 07:44:16Z fperez $ | |
|
10 | 10 | |
|
11 | 11 | from IPython import Release |
|
12 | 12 | __author__ = '%s <%s>' % Release.authors['Fernando'] |
@@ -602,8 +602,10 b' quick_reference = r"""' | |||
|
602 | 602 | IPython -- An enhanced Interactive Python - Quick Reference Card |
|
603 | 603 | ================================================================ |
|
604 | 604 | |
|
605 |
obj?, obj?? |
|
|
606 | ?os.p* : List names in os starting with p | |
|
605 | obj?, obj?? : Get help, or more help for object (also works as | |
|
606 | ?obj, ??obj). | |
|
607 | ?foo.*abc* : List names in 'foo' containing 'abc' in them. | |
|
608 | %magic : Information about IPython's 'magic' % functions. | |
|
607 | 609 | |
|
608 | 610 | Magic functions are prefixed by %, and typically take their arguments without |
|
609 | 611 | parentheses, quotes or even commas for convenience. |
@@ -1,3 +1,35 b'' | |||
|
1 | 2007-09-07 Fernando Perez <Fernando.Perez@colorado.edu> | |
|
2 | ||
|
3 | * IPython/OInspect.py (Inspector.pinfo): fixed bug that was | |
|
4 | preventing source display in certain cases. In reality I think | |
|
5 | the problem is with Ubuntu's Python build, but this change works | |
|
6 | around the issue in some cases (not in all, unfortunately). I'd | |
|
7 | filed a Python bug on this with more details, but in the change of | |
|
8 | bug trackers it seems to have been lost. | |
|
9 | ||
|
10 | * IPython/Magic.py (magic_dhist): restore %dhist. No, cd -TAB is | |
|
11 | not the same, it's not self-documenting, doesn't allow range | |
|
12 | selection, and sorts alphabetically instead of numerically. | |
|
13 | (magic_r): restore %r. No, "up + enter. One char magic" is not | |
|
14 | the same thing, since %r takes parameters to allow fast retrieval | |
|
15 | of old commands. I've received emails from users who use this a | |
|
16 | LOT, so it stays. | |
|
17 | (magic_automagic): restore %automagic. "use _ip.option.automagic" | |
|
18 | is not a valid replacement b/c it doesn't provide an complete | |
|
19 | explanation (which the automagic docstring does). | |
|
20 | (magic_autocall): restore %autocall, with improved docstring. | |
|
21 | Same argument as for others, "use _ip.options.autocall" is not a | |
|
22 | valid replacement. | |
|
23 | (magic_pdef): restore %pdef & friends. Used widely, mentioned in | |
|
24 | tutorials and online docs. | |
|
25 | ||
|
26 | 2007-09-06 Fernando Perez <Fernando.Perez@colorado.edu> | |
|
27 | ||
|
28 | * IPython/usage.py (quick_reference): mention magics in quickref, | |
|
29 | modified main banner to mention %quickref. | |
|
30 | ||
|
31 | * IPython/FakeModule.py (FakeModule): fixes for doctest compatibility. | |
|
32 | ||
|
1 | 33 | 2007-09-06 Ville Vainio <vivainio@gmail.com> |
|
2 | 34 | |
|
3 | 35 | * ipy_rehashdir.py, ipy_workdir.py, ipy_fsops.py, iplib.py: |
General Comments 0
You need to be logged in to leave comments.
Login now