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 19 |
|
4 | $Id: Magic.py 1941 2006-11-26 22:24:43Z 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 | |
@@ -961,15 +961,24 b' Currently the magic system has the following functions:\\n"""' | |||||
961 | array_type = Numeric.ArrayType.__name__ |
|
961 | array_type = Numeric.ArrayType.__name__ | |
962 |
|
962 | |||
963 | # Find all variable names and types so we can figure out column sizes |
|
963 | # Find all variable names and types so we can figure out column sizes | |
964 | get_vars = lambda i: self.shell.user_ns[i] |
|
964 | ||
965 | type_name = lambda v: type(v).__name__ |
|
965 | def get_vars(i): | |
|
966 | return self.shell.user_ns[i] | |||
|
967 | ||||
|
968 | # some types are well known and can be shorter | |||
|
969 | abbrevs = {'IPython.macro.Macro' : 'Macro'} | |||
|
970 | def type_name(v): | |||
|
971 | tn = type(v).__name__ | |||
|
972 | return abbrevs.get(tn,tn) | |||
|
973 | ||||
966 | varlist = map(get_vars,varnames) |
|
974 | varlist = map(get_vars,varnames) | |
967 |
|
975 | |||
968 | typelist = [] |
|
976 | typelist = [] | |
969 | for vv in varlist: |
|
977 | for vv in varlist: | |
970 | tt = type_name(vv) |
|
978 | tt = type_name(vv) | |
|
979 | ||||
971 | if tt=='instance': |
|
980 | if tt=='instance': | |
972 | typelist.append(str(vv.__class__)) |
|
981 | typelist.append( abbrevs.get(str(vv.__class__),str(vv.__class__))) | |
973 | else: |
|
982 | else: | |
974 | typelist.append(tt) |
|
983 | typelist.append(tt) | |
975 |
|
984 |
@@ -17,6 +17,8 b'' | |||||
17 |
|
17 | |||
18 | * macro.py: Give Macro a useful __repr__ method |
|
18 | * macro.py: Give Macro a useful __repr__ method | |
19 |
|
19 | |||
|
20 | * Magic.py: %whos abbreviates the typename of Macro for brevity. | |||
|
21 | ||||
20 | 2006-11-24 Walter Doerwald <walter@livinglogic.de> |
|
22 | 2006-11-24 Walter Doerwald <walter@livinglogic.de> | |
21 | * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that |
|
23 | * IPython/Extensions/astyle.py: Do a relative import of ipipe, so that | |
22 | we don't get a duplicate ipipe module, where registration of the xrepr |
|
24 | we don't get a duplicate ipipe module, where registration of the xrepr |
General Comments 0
You need to be logged in to leave comments.
Login now