MCPcopy Index your code
hub / github.com/python/cpython / _run_action

Function _run_action

Lib/test/test__interpchannels.py:213–246  ·  view source on GitHub ↗
(cid, action, end, state)

Source from the content-addressed store, hash-verified

211
212
213def _run_action(cid, action, end, state):
214 if action == 'use':
215 if end == 'send':
216 _channels.send(cid, b'spam', blocking=False)
217 return state.incr()
218 elif end == 'recv':
219 if not state.pending:
220 try:
221 _channels.recv(cid)
222 except _channels.ChannelEmptyError:
223 return state
224 else:
225 raise Exception('expected ChannelEmptyError')
226 else:
227 recv_nowait(cid)
228 return state.decr()
229 else:
230 raise ValueError(end)
231 elif action == 'close':
232 kwargs = {}
233 if end in ('recv', 'send'):
234 kwargs[end] = True
235 _channels.close(cid, **kwargs)
236 return state.close()
237 elif action == 'force-close':
238 kwargs = {
239 'force': True,
240 }
241 if end in ('recv', 'send'):
242 kwargs[end] = True
243 _channels.close(cid, **kwargs)
244 return state.close(force=True)
245 else:
246 raise ValueError(action)
247
248
249def clean_up_channels():

Callers 1

run_actionFunction · 0.85

Calls 6

recv_nowaitFunction · 0.85
incrMethod · 0.80
decrMethod · 0.80
sendMethod · 0.45
recvMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…