Show More
@@ -100,6 +100,8 b' class StoreMagics(Magics):' | |||||
100 | * ``%store -z`` - Remove all variables from storage |
|
100 | * ``%store -z`` - Remove all variables from storage | |
101 | * ``%store -r`` - Refresh all variables from store (delete |
|
101 | * ``%store -r`` - Refresh all variables from store (delete | |
102 | current vals) |
|
102 | current vals) | |
|
103 | * ``%store -r spam`` - Refresh specified variable from store (delete | |||
|
104 | current val) | |||
103 | * ``%store foo >a.txt`` - Store value of foo to new file a.txt |
|
105 | * ``%store foo >a.txt`` - Store value of foo to new file a.txt | |
104 | * ``%store foo >>a.txt`` - Append value of foo to file a.txt |
|
106 | * ``%store foo >>a.txt`` - Append value of foo to file a.txt | |
105 |
|
107 | |||
@@ -133,9 +135,17 b' class StoreMagics(Magics):' | |||||
133 | del db[k] |
|
135 | del db[k] | |
134 |
|
136 | |||
135 | elif 'r' in opts: |
|
137 | elif 'r' in opts: | |
|
138 | if args: | |||
|
139 | try: | |||
|
140 | obj = db['autorestore/' + args[0]] | |||
|
141 | except KeyError: | |||
|
142 | print "Unable to restore variable '%s', (use %%store -d to forget!)" % args[0] | |||
|
143 | print "The error was:", sys.exc_info()[0] | |||
|
144 | else: | |||
|
145 | ip.user_ns[args[0]] = obj | |||
|
146 | else: | |||
136 | refresh_variables(ip) |
|
147 | refresh_variables(ip) | |
137 |
|
148 | |||
138 |
|
||||
139 | # run without arguments -> list variables & values |
|
149 | # run without arguments -> list variables & values | |
140 | elif not args: |
|
150 | elif not args: | |
141 | vars = db.keys('autorestore/*') |
|
151 | vars = db.keys('autorestore/*') |
General Comments 0
You need to be logged in to leave comments.
Login now