Show More
@@ -44,6 +44,7 from IPython.core.fakemodule import FakeModule, init_fakemod_dict | |||
|
44 | 44 | from IPython.core.inputlist import InputList |
|
45 | 45 | from IPython.core.logger import Logger |
|
46 | 46 | from IPython.core.magic import Magic |
|
47 | from IPython.core.payload import PayloadManager | |
|
47 | 48 | from IPython.core.plugin import PluginManager |
|
48 | 49 | from IPython.core.prefilter import PrefilterManager |
|
49 | 50 | from IPython.core.displayhook import DisplayHook |
@@ -209,7 +210,7 class InteractiveShell(Configurable, Magic): | |||
|
209 | 210 | display_trap = Instance('IPython.core.display_trap.DisplayTrap') |
|
210 | 211 | extension_manager = Instance('IPython.core.extensions.ExtensionManager') |
|
211 | 212 | plugin_manager = Instance('IPython.core.plugin.PluginManager') |
|
212 |
payload_manager = Instance('IPython.core.payl |
|
|
213 | payload_manager = Instance('IPython.core.payload.PayloadManager') | |
|
213 | 214 | |
|
214 | 215 | def __init__(self, config=None, ipython_dir=None, |
|
215 | 216 | user_ns=None, user_global_ns=None, |
@@ -19,7 +19,7 Authors: | |||
|
19 | 19 | #----------------------------------------------------------------------------- |
|
20 | 20 | |
|
21 | 21 | from IPython.config.configurable import Configurable |
|
22 |
from IPython.utils.traitlets import |
|
|
22 | from IPython.utils.traitlets import List | |
|
23 | 23 | |
|
24 | 24 | #----------------------------------------------------------------------------- |
|
25 | 25 | # Main payload class |
@@ -27,13 +27,15 from IPython.utils.traitlets import Dict | |||
|
27 | 27 | |
|
28 | 28 | class PayloadManager(Configurable): |
|
29 | 29 | |
|
30 |
_payload = |
|
|
30 | _payload = List([]) | |
|
31 | 31 | |
|
32 |
def write_payload(self, |
|
|
33 | self.payload[key] = value | |
|
32 | def write_payload(self, data): | |
|
33 | if not isinstance(data, dict): | |
|
34 | raise TypeError('Each payload write must be a dict, got: %r' % data) | |
|
35 | self.payload.append(data) | |
|
34 | 36 | |
|
35 | 37 | def reset_payload(self): |
|
36 |
self.payload = |
|
|
38 | self.payload = [] | |
|
37 | 39 | |
|
38 | 40 | def read_payload(self): |
|
39 | 41 | return self._payload |
General Comments 0
You need to be logged in to leave comments.
Login now