Show More
@@ -1,7 +1,7 b'' | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """Magic functions for InteractiveShell. |
|
2 | """Magic functions for InteractiveShell. | |
3 |
|
3 | |||
4 |
$Id: Magic.py 242 |
|
4 | $Id: Magic.py 2426 2007-06-11 17:12:29Z vivainio $""" | |
5 |
|
5 | |||
6 | #***************************************************************************** |
|
6 | #***************************************************************************** | |
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
|
7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and | |
@@ -35,6 +35,7 b' import textwrap' | |||||
35 | from cStringIO import StringIO |
|
35 | from cStringIO import StringIO | |
36 | from getopt import getopt,GetoptError |
|
36 | from getopt import getopt,GetoptError | |
37 | from pprint import pprint, pformat |
|
37 | from pprint import pprint, pformat | |
|
38 | from sets import Set | |||
38 |
|
39 | |||
39 | # cProfile was added in Python2.5 |
|
40 | # cProfile was added in Python2.5 | |
40 | try: |
|
41 | try: | |
@@ -70,7 +71,7 b' def compress_dhist(dh):' | |||||
70 | head, tail = dh[:-10], dh[-10:] |
|
71 | head, tail = dh[:-10], dh[-10:] | |
71 |
|
72 | |||
72 | newhead = [] |
|
73 | newhead = [] | |
73 |
done = |
|
74 | done = Set() | |
74 | for h in head: |
|
75 | for h in head: | |
75 | if h in done: |
|
76 | if h in done: | |
76 | continue |
|
77 | continue | |
@@ -2480,7 +2481,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2480 | cwd = os.getcwd() |
|
2481 | cwd = os.getcwd() | |
2481 | dhist = self.shell.user_ns['_dh'] |
|
2482 | dhist = self.shell.user_ns['_dh'] | |
2482 | dhist.append(cwd) |
|
2483 | dhist.append(cwd) | |
2483 |
self.db['dhist'] = compress_dhist(dhist[-100:] |
|
2484 | self.db['dhist'] = compress_dhist(dhist)[-100:] | |
2484 |
|
2485 | |||
2485 | else: |
|
2486 | else: | |
2486 | os.chdir(self.shell.home_dir) |
|
2487 | os.chdir(self.shell.home_dir) | |
@@ -2489,7 +2490,7 b' Defaulting color scheme to \'NoColor\'"""' | |||||
2489 | cwd = os.getcwd() |
|
2490 | cwd = os.getcwd() | |
2490 | dhist = self.shell.user_ns['_dh'] |
|
2491 | dhist = self.shell.user_ns['_dh'] | |
2491 | dhist.append(cwd) |
|
2492 | dhist.append(cwd) | |
2492 |
self.db['dhist'] = dhist[- |
|
2493 | self.db['dhist'] = compress_dhist(dhist)[-100:] | |
2493 | if not 'q' in opts: |
|
2494 | if not 'q' in opts: | |
2494 | print self.shell.user_ns['_dh'][-1] |
|
2495 | print self.shell.user_ns['_dh'][-1] | |
2495 |
|
2496 |
General Comments 0
You need to be logged in to leave comments.
Login now