MCPcopy Create free account
hub / github.com/ipython/ipython / write_payload

Method write_payload

IPython/core/payload.py:32–49  ·  view source on GitHub ↗

Include or update the specified `data` payload in the PayloadManager. If a previous payload with the same source exists and `single` is True, it will be overwritten with the new one.

(self, data, single=True)

Source from the content-addressed store, hash-verified

30 _payload = List([])
31
32 def write_payload(self, data, single=True):
33 """Include or update the specified `data` payload in the PayloadManager.
34
35 If a previous payload with the same source exists and `single` is True,
36 it will be overwritten with the new one.
37 """
38
39 if not isinstance(data, dict):
40 raise TypeError('Each payload write must be a dict, got: %r' % data)
41
42 if single and 'source' in data:
43 source = data['source']
44 for i, pl in enumerate(self._payload):
45 if 'source' in pl and pl['source'] == source:
46 self._payload[i] = data
47 return
48
49 self._payload.append(data)
50
51 def read_payload(self):
52 return self._payload

Callers 1

pageFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected