Show More
@@ -1,35 +1,38 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | """ |
|
3 | """ | |
4 | This module is *completely* deprecated and should no longer be used for |
|
4 | This module is *completely* deprecated and should no longer be used for | |
5 | any purpose. Currently, we have a few parts of the core that have |
|
5 | any purpose. Currently, we have a few parts of the core that have | |
6 | not been componentized and thus, still rely on this module. When everything |
|
6 | not been componentized and thus, still rely on this module. When everything | |
7 | has been made into a component, this module will be sent to deathrow. |
|
7 | has been made into a component, this module will be sent to deathrow. | |
8 | """ |
|
8 | """ | |
9 |
|
9 | |||
10 | #----------------------------------------------------------------------------- |
|
10 | #----------------------------------------------------------------------------- | |
11 | # Copyright (C) 2008-2009 The IPython Development Team |
|
11 | # Copyright (C) 2008-2009 The IPython Development Team | |
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. | |
15 | #----------------------------------------------------------------------------- |
|
15 | #----------------------------------------------------------------------------- | |
16 |
|
16 | |||
17 | #----------------------------------------------------------------------------- |
|
17 | #----------------------------------------------------------------------------- | |
18 | # Imports |
|
18 | # Imports | |
19 | #----------------------------------------------------------------------------- |
|
19 | #----------------------------------------------------------------------------- | |
20 |
|
20 | |||
21 | from IPython.core.error import TryNext, UsageError |
|
21 | from IPython.core.error import TryNext, UsageError, IPythonCoreError | |
22 |
|
22 | |||
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 | # Classes and functions |
|
24 | # Classes and functions | |
25 | #----------------------------------------------------------------------------- |
|
25 | #----------------------------------------------------------------------------- | |
26 |
|
26 | |||
|
27 | ||||
27 | def get(): |
|
28 | def get(): | |
28 | """Get the most recently created InteractiveShell instance.""" |
|
29 | """Get the most recently created InteractiveShell instance.""" | |
29 | from IPython.core.iplib import InteractiveShell |
|
30 | from IPython.core.iplib import InteractiveShell | |
30 | insts = InteractiveShell.get_instances() |
|
31 | insts = InteractiveShell.get_instances() | |
|
32 | if len(insts)==0: | |||
|
33 | return None | |||
31 | most_recent = insts[0] |
|
34 | most_recent = insts[0] | |
32 | for inst in insts[1:]: |
|
35 | for inst in insts[1:]: | |
33 | if inst.created > most_recent.created: |
|
36 | if inst.created > most_recent.created: | |
34 | most_recent = inst |
|
37 | most_recent = inst | |
35 | return most_recent |
|
38 | return most_recent |
General Comments 0
You need to be logged in to leave comments.
Login now