##// END OF EJS Templates
Minor fix to exit/quit
Fernando Perez -
Show More
1 NO CONTENT: modified file chmod 100644 => 100755
@@ -1,41 +1,43 b''
1 1 # coding: utf-8
2 2 """
3 3 A simple class for quitting IPython.
4 4
5 5 Authors
6 6 -------
7 7 * Fernando Perez
8 8 * Brian Granger
9 9 """
10 10
11 11 #-----------------------------------------------------------------------------
12 12 # Copyright (C) 2008-2009 The IPython Development Team
13 13 #
14 14 # Distributed under the terms of the BSD License. The full license is in
15 15 # the file COPYING, distributed as part of this software.
16 16 #-----------------------------------------------------------------------------
17 17
18 18 #-----------------------------------------------------------------------------
19 19 # Imports
20 20 #-----------------------------------------------------------------------------
21 21
22 22 import sys
23 23
24 24 class Quitter(object):
25 25 """Simple class to handle exit, similar to Python 2.5's.
26 26
27 27 It handles exiting in an ipython-safe manner, which the one in Python 2.5
28 28 doesn't do (obviously, since it doesn't know about ipython)."""
29 29
30 30 def __init__(self, shell, name):
31 31 self.shell = shell
32 32 self.name = name
33 33
34 34 def __str__(self):
35 35 return 'Type %s() to exit.' % self.name
36 36
37 37 def __call__(self):
38 38 self.shell.ask_exit()
39 return 'Bye.'
40 39
41 __repr__ = __call__
40 # Repr MUST return a string, else display like pprint hooks get confused
41 def __repr__(self):
42 self.shell.ask_exit()
43 return 'Bye.'
General Comments 0
You need to be logged in to leave comments. Login now