##// END OF EJS Templates
Small fix in ultraTB, and fix autocall....
fperez -
r88:34373562
parent child
Show More
@@ -1,10 +1,10
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Tools for coloring text in ANSI terminals.
2 """Tools for coloring text in ANSI terminals.
3
3
4 $Id: ColorANSI.py 951 2005-12-25 00:57:24Z fperez $"""
4 $Id: ColorANSI.py 994 2006-01-08 08:29:44Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2002-2004 Fernando Perez. <fperez@colorado.edu>
7 # Copyright (C) 2002-2006 Fernando Perez. <fperez@colorado.edu>
8 #
8 #
9 # Distributed under the terms of the BSD License. The full license is in
9 # Distributed under the terms of the BSD License. The full license is in
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
@@ -1,10 +1,10
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Configuration loader
2 """Configuration loader
3
3
4 $Id: ConfigLoader.py 958 2005-12-27 23:17:51Z fperez $"""
4 $Id: ConfigLoader.py 994 2006-01-08 08:29:44Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
7 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
8 #
8 #
9 # Distributed under the terms of the BSD License. The full license is in
9 # Distributed under the terms of the BSD License. The full license is in
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
@@ -1,10 +1,10
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """sys.excepthook for IPython itself, leaves a detailed report on disk.
2 """sys.excepthook for IPython itself, leaves a detailed report on disk.
3
3
4 $Id: CrashHandler.py 958 2005-12-27 23:17:51Z fperez $"""
4 $Id: CrashHandler.py 994 2006-01-08 08:29:44Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
7 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
8 #
8 #
9 # Distributed under the terms of the BSD License. The full license is in
9 # Distributed under the terms of the BSD License. The full license is in
10 # the file COPYING, distributed as part of this software.
10 # the file COPYING, distributed as part of this software.
@@ -15,7 +15,23 details on the PSF (Python Software Foundation) standard license, see:
15
15
16 http://www.python.org/2.2.3/license.html
16 http://www.python.org/2.2.3/license.html
17
17
18 $Id: Debugger.py 958 2005-12-27 23:17:51Z fperez $"""
18 $Id: Debugger.py 994 2006-01-08 08:29:44Z fperez $"""
19
20 #*****************************************************************************
21 #
22 # Since this file is essentially a modified copy of the pdb module which is
23 # part of the standard Python distribution, I assume that the proper procedure
24 # is to maintain its copyright as belonging to the Python Software Foundation
25 # (in addition to my own, for all new code).
26 #
27 # Copyright (C) 2001 Python Software Foundation, www.python.org
28 # Copyright (C) 2005-2006 Fernando Perez. <fperez@colorado.edu>
29 #
30 # Distributed under the terms of the BSD License. The full license is in
31 # the file COPYING, distributed as part of this software.
32 #
33 #*****************************************************************************
34
19
35
20 from IPython import Release
36 from IPython import Release
21 __author__ = '%s <%s>' % Release.authors['Fernando']
37 __author__ = '%s <%s>' % Release.authors['Fernando']
@@ -5,11 +5,11 We define a special input line filter to allow typing lines which begin with
5 '~', '/' or '.'. If one of those strings is encountered, it is automatically
5 '~', '/' or '.'. If one of those strings is encountered, it is automatically
6 executed.
6 executed.
7
7
8 $Id: InterpreterExec.py 638 2005-07-18 03:01:41Z fperez $"""
8 $Id: InterpreterExec.py 994 2006-01-08 08:29:44Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2004 W.J. van der Laan <gnufnork@hetdigitalegat.nl>
11 # Copyright (C) 2004 W.J. van der Laan <gnufnork@hetdigitalegat.nl>
12 # Copyright (C) 2004 Fernando Perez <fperez@colorado.edu>
12 # Copyright (C) 2004-2006 Fernando Perez <fperez@colorado.edu>
13 #
13 #
14 # Distributed under the terms of the BSD License. The full license is in
14 # Distributed under the terms of the BSD License. The full license is in
15 # the file COPYING, distributed as part of this software.
15 # the file COPYING, distributed as part of this software.
@@ -33,7 +33,7 only sees the real part of the code.
33 All other input is processed normally.
33 All other input is processed normally.
34 """
34 """
35 #*****************************************************************************
35 #*****************************************************************************
36 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
36 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
37 #
37 #
38 # Distributed under the terms of the BSD License. The full license is in
38 # Distributed under the terms of the BSD License. The full license is in
39 # the file COPYING, distributed as part of this software.
39 # the file COPYING, distributed as part of this software.
@@ -2,12 +2,12
2 """
2 """
3 Logger class for IPython's logging facilities.
3 Logger class for IPython's logging facilities.
4
4
5 $Id: Logger.py 988 2006-01-02 21:21:47Z fperez $
5 $Id: Logger.py 994 2006-01-08 08:29:44Z fperez $
6 """
6 """
7
7
8 #*****************************************************************************
8 #*****************************************************************************
9 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
9 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
10 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
@@ -1,11 +1,11
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Magic functions for InteractiveShell.
2 """Magic functions for InteractiveShell.
3
3
4 $Id: Magic.py 991 2006-01-04 18:15:34Z fperez $"""
4 $Id: Magic.py 994 2006-01-08 08:29:44Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
7 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
8 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
@@ -56,6 +56,7 def on_off(tag):
56 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
56 """Return an ON/OFF string for a 1/0 input. Simple utility function."""
57 return ['OFF','ON'][tag]
57 return ['OFF','ON'][tag]
58
58
59 class Bunch: pass
59
60
60 #***************************************************************************
61 #***************************************************************************
61 # Main class implementing Magic functionality
62 # Main class implementing Magic functionality
@@ -84,6 +85,9 class Magic:
84 self.magic_prun = self.profile_missing_notice
85 self.magic_prun = self.profile_missing_notice
85 self.shell = shell
86 self.shell = shell
86
87
88 # namespace for holding state we may need
89 self._magic_state = Bunch()
90
87 def profile_missing_notice(self, *args, **kwargs):
91 def profile_missing_notice(self, *args, **kwargs):
88 error("""\
92 error("""\
89 The profile module could not be found. If you are a Debian user,
93 The profile module could not be found. If you are a Debian user,
@@ -424,11 +428,36 Currently the magic system has the following functions:\n"""
424 def magic_autocall(self, parameter_s = ''):
428 def magic_autocall(self, parameter_s = ''):
425 """Make functions callable without having to type parentheses.
429 """Make functions callable without having to type parentheses.
426
430
427 This cycles the autocall command line through its three valid values
431 Usage:
428 (0->Off, 1->Smart, 2->Full)"""
432
433 %autocall [mode]
434
435 The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the
436 value is toggled on and off (remembering the previous state)."""
429
437
430 rc = self.shell.rc
438 rc = self.shell.rc
431 rc.autocall = not rc.autocall
439
440 if parameter_s:
441 arg = int(parameter_s)
442 else:
443 arg = 'toggle'
444
445 if not arg in (0,1,2,'toggle'):
446 error('Valid modes: (0->Off, 1->Smart, 2->Full')
447 return
448
449 if arg in (0,1,2):
450 rc.autocall = arg
451 else: # toggle
452 if rc.autocall:
453 self._magic_state.autocall_save = rc.autocall
454 rc.autocall = 0
455 else:
456 try:
457 rc.autocall = self._magic_state.autocall_save
458 except AttributeError:
459 rc.autocall = self._magic_state.autocall_save = 1
460
432 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
461 print "Automatic calling is:",['OFF','Smart','Full'][rc.autocall]
433
462
434 def magic_autoindent(self, parameter_s = ''):
463 def magic_autoindent(self, parameter_s = ''):
@@ -2,10 +2,10
2 """
2 """
3 Classes for handling input/output prompts.
3 Classes for handling input/output prompts.
4
4
5 $Id: Prompts.py 975 2005-12-29 23:50:22Z fperez $"""
5 $Id: Prompts.py 994 2006-01-08 08:29:44Z fperez $"""
6
6
7 #*****************************************************************************
7 #*****************************************************************************
8 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
@@ -1,10 +1,10
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Release data for the IPython project.
2 """Release data for the IPython project.
3
3
4 $Id: Release.py 992 2006-01-04 18:35:40Z fperez $"""
4 $Id: Release.py 994 2006-01-08 08:29:44Z fperez $"""
5
5
6 #*****************************************************************************
6 #*****************************************************************************
7 # Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>
7 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
8 #
8 #
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
9 # Copyright (c) 2001 Janko Hauser <jhauser@zscout.de> and Nathaniel Gray
10 # <n8gray@caltech.edu>
10 # <n8gray@caltech.edu>
@@ -24,7 +24,7 name = 'ipython'
24
24
25 version = '0.7.0.rc8'
25 version = '0.7.0.rc8'
26
26
27 revision = '$Revision: 992 $'
27 revision = '$Revision: 994 $'
28
28
29 description = "An enhanced interactive Python shell."
29 description = "An enhanced interactive Python shell."
30
30
@@ -4,10 +4,10
4 All the matplotlib support code was co-developed with John Hunter,
4 All the matplotlib support code was co-developed with John Hunter,
5 matplotlib's author.
5 matplotlib's author.
6
6
7 $Id: Shell.py 993 2006-01-04 19:51:01Z fperez $"""
7 $Id: Shell.py 994 2006-01-08 08:29:44Z fperez $"""
8
8
9 #*****************************************************************************
9 #*****************************************************************************
10 # Copyright (C) 2001-2004 Fernando Perez <fperez@colorado.edu>
10 # Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>
11 #
11 #
12 # Distributed under the terms of the BSD License. The full license is in
12 # Distributed under the terms of the BSD License. The full license is in
13 # the file COPYING, distributed as part of this software.
13 # the file COPYING, distributed as part of this software.
@@ -18,11 +18,11 http://folk.uio.no/hpl/scripting
18 (although ultimately no code from this text was used, as IPython's system is a
18 (although ultimately no code from this text was used, as IPython's system is a
19 separate implementation).
19 separate implementation).
20
20
21 $Id: background_jobs.py 958 2005-12-27 23:17:51Z fperez $
21 $Id: background_jobs.py 994 2006-01-08 08:29:44Z fperez $
22 """
22 """
23
23
24 #*****************************************************************************
24 #*****************************************************************************
25 # Copyright (C) 2005 Fernando Perez <fperez@colorado.edu>
25 # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu>
26 #
26 #
27 # Distributed under the terms of the BSD License. The full license is in
27 # Distributed under the terms of the BSD License. The full license is in
28 # the file COPYING, distributed as part of this software.
28 # the file COPYING, distributed as part of this software.
@@ -56,7 +56,7 used, and this module (and the readline module) are silently inactive.
56 # Software Foundation (in addition to my own, for all new code).
56 # Software Foundation (in addition to my own, for all new code).
57 #
57 #
58 # Copyright (C) 2001 Python Software Foundation, www.python.org
58 # Copyright (C) 2001 Python Software Foundation, www.python.org
59 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
59 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
60 #
60 #
61 # Distributed under the terms of the BSD License. The full license is in
61 # Distributed under the terms of the BSD License. The full license is in
62 # the file COPYING, distributed as part of this software.
62 # the file COPYING, distributed as part of this software.
@@ -100,7 +100,7 WARNING: this module uses Python 2.3 features, so it won't work in 2.2
100 environments.
100 environments.
101 """
101 """
102 #*****************************************************************************
102 #*****************************************************************************
103 # Copyright (C) 2005 Fernando Perez. <Fernando.Perez@colorado.edu>
103 # Copyright (C) 2005-2006 Fernando Perez. <Fernando.Perez@colorado.edu>
104 #
104 #
105 # Distributed under the terms of the BSD License. The full license is in
105 # Distributed under the terms of the BSD License. The full license is in
106 # the file COPYING, distributed as part of this software.
106 # the file COPYING, distributed as part of this software.
@@ -5,7 +5,7 Color schemes for exception handling code in IPython.
5 $Id: Prompts.py 638 2005-07-18 03:01:41Z fperez $"""
5 $Id: Prompts.py 638 2005-07-18 03:01:41Z fperez $"""
6
6
7 #*****************************************************************************
7 #*****************************************************************************
8 # Copyright (C) 2005 Fernando Perez <fperez@colorado.edu>
8 # Copyright (C) 2005-2006 Fernando Perez <fperez@colorado.edu>
9 #
9 #
10 # Distributed under the terms of the BSD License. The full license is in
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
11 # the file COPYING, distributed as part of this software.
@@ -5,10 +5,10 General purpose utilities.
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
5 This is a grab-bag of stuff I find useful in most programs I write. Some of
6 these things are also convenient when working at the command line.
6 these things are also convenient when working at the command line.
7
7
8 $Id: genutils.py 990 2006-01-04 06:59:02Z fperez $"""
8 $Id: genutils.py 994 2006-01-08 08:29:44Z fperez $"""
9
9
10 #*****************************************************************************
10 #*****************************************************************************
11 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
11 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
12 #
12 #
13 # Distributed under the terms of the BSD License. The full license is in
13 # Distributed under the terms of the BSD License. The full license is in
14 # the file COPYING, distributed as part of this software.
14 # the file COPYING, distributed as part of this software.
@@ -6,12 +6,12 Requires Python 2.1 or newer.
6
6
7 This file contains all the classes and helper functions specific to IPython.
7 This file contains all the classes and helper functions specific to IPython.
8
8
9 $Id: iplib.py 993 2006-01-04 19:51:01Z fperez $
9 $Id: iplib.py 994 2006-01-08 08:29:44Z fperez $
10 """
10 """
11
11
12 #*****************************************************************************
12 #*****************************************************************************
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
13 # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and
14 # Copyright (C) 2001-2005 Fernando Perez. <fperez@colorado.edu>
14 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
15 #
15 #
16 # Distributed under the terms of the BSD License. The full license is in
16 # Distributed under the terms of the BSD License. The full license is in
17 # the file COPYING, distributed as part of this software.
17 # the file COPYING, distributed as part of this software.
@@ -75,6 +75,8 from IPython.background_jobs import BackgroundJobManager
75 from IPython.usage import cmd_line_usage,interactive_usage
75 from IPython.usage import cmd_line_usage,interactive_usage
76 from IPython.genutils import *
76 from IPython.genutils import *
77
77
78 # Globals
79
78 # store the builtin raw_input globally, and use this always, in case user code
80 # store the builtin raw_input globally, and use this always, in case user code
79 # overwrites it (like wx.py.PyShell does)
81 # overwrites it (like wx.py.PyShell does)
80 raw_input_original = raw_input
82 raw_input_original = raw_input
@@ -83,6 +85,7 raw_input_original = raw_input
83 ini_spaces_re = re.compile(r'^(\s+)')
85 ini_spaces_re = re.compile(r'^(\s+)')
84 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
86 dedent_re = re.compile(r'^\s+raise|^\s+return|^\s+pass')
85
87
88
86 #****************************************************************************
89 #****************************************************************************
87 # Some utility function definitions
90 # Some utility function definitions
88
91
@@ -100,13 +103,12 def softspace(file, newvalue):
100 pass
103 pass
101 return oldvalue
104 return oldvalue
102
105
103 #****************************************************************************
104
105
106
106 #****************************************************************************
107 #****************************************************************************
107 # Local use exceptions
108 # Local use exceptions
108 class SpaceInInput(exceptions.Exception): pass
109 class SpaceInInput(exceptions.Exception): pass
109
110
111
110 #****************************************************************************
112 #****************************************************************************
111 # Local use classes
113 # Local use classes
112 class Bunch: pass
114 class Bunch: pass
@@ -1183,7 +1185,15 want to merge them back into the new files.""" % locals()
1183 return False
1185 return False
1184 except EOFError:
1186 except EOFError:
1185 return False
1187 return False
1186 self.hooks.fix_error_editor(e.filename,e.lineno,e.offset,e.msg)
1188
1189 def int0(x):
1190 try:
1191 return int(x)
1192 except TypeError:
1193 return 0
1194 # always pass integer line and offset values to editor hook
1195 self.hooks.fix_error_editor(e.filename,
1196 int0(e.lineno),int0(e.offset),e.msg)
1187 return True
1197 return True
1188
1198
1189 def edit_syntax_error(self):
1199 def edit_syntax_error(self):
@@ -6,10 +6,10 Requires Python 2.1 or better.
6
6
7 This file contains the main make_IPython() starter function.
7 This file contains the main make_IPython() starter function.
8
8
9 $Id: ipmaker.py 990 2006-01-04 06:59:02Z fperez $"""
9 $Id: ipmaker.py 994 2006-01-08 08:29:44Z fperez $"""
10
10
11 #*****************************************************************************
11 #*****************************************************************************
12 # Copyright (C) 2001-2004 Fernando Perez. <fperez@colorado.edu>
12 # Copyright (C) 2001-2006 Fernando Perez. <fperez@colorado.edu>
13 #
13 #
14 # Distributed under the terms of the BSD License. The full license is in
14 # Distributed under the terms of the BSD License. The full license is in
15 # the file COPYING, distributed as part of this software.
15 # the file COPYING, distributed as part of this software.
@@ -60,7 +60,7 You can implement other color schemes easily, the syntax is fairly
60 self-explanatory. Please send back new schemes you develop to the author for
60 self-explanatory. Please send back new schemes you develop to the author for
61 possible inclusion in future releases.
61 possible inclusion in future releases.
62
62
63 $Id: ultraTB.py 992 2006-01-04 18:35:40Z fperez $"""
63 $Id: ultraTB.py 994 2006-01-08 08:29:44Z fperez $"""
64
64
65 #*****************************************************************************
65 #*****************************************************************************
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
66 # Copyright (C) 2001 Nathaniel Gray <n8gray@caltech.edu>
@@ -140,7 +140,6 def _fixed_getinnerframes(etb, context=1,tb_offset=0):
140 lines = (['\n'] * -maybeStart) + lines
140 lines = (['\n'] * -maybeStart) + lines
141 if len(lines) < context:
141 if len(lines) < context:
142 lines += ['\n'] * (context - len(lines))
142 lines += ['\n'] * (context - len(lines))
143 assert len(lines) == context
144 buf = list(records[i])
143 buf = list(records[i])
145 buf[LNUM_POS] = lnum
144 buf[LNUM_POS] = lnum
146 buf[INDEX_POS] = lnum - 1 - start
145 buf[INDEX_POS] = lnum - 1 - start
@@ -1,9 +1,12
1 """Set of functions to work with console on Windows.
1 """
2 """
2 Set of functions to work with console on Windows.
3
3
4 Author: Alexander Belchenko (e-mail: bialix AT ukr.net)
4 #*****************************************************************************
5 License: Public domain
5 # Copyright (C) 2005 Alexander Belchenko <bialix@ukr.net>
6 """
6 #
7 # This file is placed in the public domain.
8 #
9 #*****************************************************************************
7
10
8 __author__ = 'Alexander Belchenko (e-mail: bialix AT ukr.net)'
11 __author__ = 'Alexander Belchenko (e-mail: bialix AT ukr.net)'
9 __license__ = 'Public domain'
12 __license__ = 'Public domain'
@@ -1,3 +1,17
1 2006-01-08 Fernando Perez <Fernando.Perez@colorado.edu>
2
3 * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now
4 it can be used as a (stateful) toggle, or with a direct parameter.
5
6 * IPython/ultraTB.py (_fixed_getinnerframes): remove debug assert which
7 could be triggered in certain cases and cause the traceback
8 printer not to work.
9
10 2006-01-07 Fernando Perez <Fernando.Perez@colorado.edu>
11
12 * IPython/iplib.py (_should_recompile): Small fix, closes
13 http://www.scipy.net/roundup/ipython/issue48. Patch by Scott.
14
1 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
15 2006-01-04 Fernando Perez <Fernando.Perez@colorado.edu>
2
16
3 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
17 * IPython/Shell.py (IPShellGTK.mainloop): fix bug in the GTK
General Comments 0
You need to be logged in to leave comments. Login now