Show More
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | """Magic functions for InteractiveShell. |
|
3 | 3 | |
|
4 |
$Id: Magic.py 193 |
|
|
4 | $Id: Magic.py 1934 2006-11-26 20:37:01Z vivainio $""" | |
|
5 | 5 | |
|
6 | 6 | #***************************************************************************** |
|
7 | 7 | # Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and |
@@ -1028,54 +1028,6 b' Currently the magic system has the following functions:\\n"""' | |||
|
1028 | 1028 | for i in self.magic_who_ls(): |
|
1029 | 1029 | del(user_ns[i]) |
|
1030 | 1030 | |
|
1031 | def magic_config(self,parameter_s=''): | |
|
1032 | """Handle IPython's internal configuration. | |
|
1033 | ||
|
1034 | If called without arguments, it will print IPython's complete internal | |
|
1035 | configuration. | |
|
1036 | ||
|
1037 | If called with one argument, it will print the value of that key in | |
|
1038 | the configuration. | |
|
1039 | ||
|
1040 | If called with more than one argument, the first is interpreted as a | |
|
1041 | key and the rest as a Python expression which gets eval()'d. | |
|
1042 | ||
|
1043 | Examples: | |
|
1044 | ||
|
1045 | In [1]: s='A Python string' | |
|
1046 | ||
|
1047 | In [2]: !echo $s | |
|
1048 | A Python string | |
|
1049 | ||
|
1050 | In [3]: config system_verbose True | |
|
1051 | ||
|
1052 | In [4]: !echo $s | |
|
1053 | IPython system call: echo A Python string | |
|
1054 | A Python string | |
|
1055 | ||
|
1056 | In [5]: %config system_header 'sys> ' | |
|
1057 | ||
|
1058 | In [6]: !echo $s | |
|
1059 | sys> echo A Python string | |
|
1060 | A Python string | |
|
1061 | ||
|
1062 | # Notice the extra quotes to protect the string after interpolation: | |
|
1063 | In [7]: header = "'sys2> '" | |
|
1064 | ||
|
1065 | In [8]: %config system_header $header | |
|
1066 | ||
|
1067 | In [9]: !echo $s | |
|
1068 | sys2> echo A Python string | |
|
1069 | A Python string | |
|
1070 | """ | |
|
1071 | ||
|
1072 | args = parameter_s.split(None,1) | |
|
1073 | key = args[0] | |
|
1074 | if len(args)==1: | |
|
1075 | self.shell.ipconfig(key) | |
|
1076 | else: | |
|
1077 | self.shell.ipconfig(key,eval(args[1])) | |
|
1078 | ||
|
1079 | 1031 | def magic_logstart(self,parameter_s=''): |
|
1080 | 1032 | """Start logging anywhere in a session. |
|
1081 | 1033 |
@@ -6,7 +6,7 b' Requires Python 2.3 or newer.' | |||
|
6 | 6 | |
|
7 | 7 | This file contains all the classes and helper functions specific to IPython. |
|
8 | 8 | |
|
9 |
$Id: iplib.py 1 |
|
|
9 | $Id: iplib.py 1934 2006-11-26 20:37:01Z vivainio $ | |
|
10 | 10 | """ |
|
11 | 11 | |
|
12 | 12 | #***************************************************************************** |
@@ -728,7 +728,6 b' class InteractiveShell(object,Magic):' | |||
|
728 | 728 | ipmagic = self.ipmagic, |
|
729 | 729 | ipalias = self.ipalias, |
|
730 | 730 | ipsystem = self.ipsystem, |
|
731 | ipconfig = self.ipconfig, | |
|
732 | 731 | _ip = self.api |
|
733 | 732 | ) |
|
734 | 733 | for biname,bival in builtins_new.items(): |
@@ -964,29 +963,6 b' class InteractiveShell(object,Magic):' | |||
|
964 | 963 | else: |
|
965 | 964 | error("Alias `%s` not found." % alias_name) |
|
966 | 965 | |
|
967 | def ipconfig(self,key=None,value=None): | |
|
968 | """Manipulate the IPython config. | |
|
969 | ||
|
970 | This provides a python interface to | |
|
971 | If called with no arguments, it prints the internal IPython config | |
|
972 | ||
|
973 | Optional arguments: | |
|
974 | ||
|
975 | - key(None): if given, what key of the rc structure to return. | |
|
976 | ||
|
977 | - value(None): if given, set the key to this value.""" | |
|
978 | ||
|
979 | if key is None: | |
|
980 | page('Current configuration structure:\n'+ | |
|
981 | pformat(self.rc.dict())) | |
|
982 | else: | |
|
983 | if value is None: | |
|
984 | print '%s -> %s' % (key,self.rc[key]) | |
|
985 | else: | |
|
986 | if key not in self.rc: | |
|
987 | raise KeyError(str(key)) | |
|
988 | self.rc[key] = value | |
|
989 | ||
|
990 | 966 | def ipsystem(self,arg_s): |
|
991 | 967 | """Make a system call, using IPython.""" |
|
992 | 968 |
General Comments 0
You need to be logged in to leave comments.
Login now