MCPcopy Index your code
hub / github.com/ipython/ipython / trigger

Method trigger

IPython/core/events.py:92–108  ·  view source on GitHub ↗

Call callbacks for ``event``. Any additional arguments are passed to all callbacks registered for this event. Exceptions raised by callbacks are caught, and a message printed.

(self, event: str, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

90 raise ValueError('Function {!r} is not registered as a {} callback'.format(function, event))
91
92 def trigger(self, event: str, *args: Any, **kwargs: Any) -> None:
93 """Call callbacks for ``event``.
94
95 Any additional arguments are passed to all callbacks registered for this
96 event. Exceptions raised by callbacks are caught, and a message printed.
97 """
98 for func in self.callbacks[event][:]:
99 try:
100 func(*args, **kwargs)
101 except (Exception, KeyboardInterrupt):
102 if self.print_on_error:
103 print(
104 "Error in callback {} (for {}), with arguments args {},kwargs {}:".format(
105 func, event, args, kwargs
106 )
107 )
108 self.shell.showtraceback()
109
110# event_name -> prototype mapping
111available_events: dict[str, Callable[..., Any]] = {}

Callers 8

__init__Method · 0.80
run_cellMethod · 0.80
run_cell_asyncMethod · 0.80
test_cb_errorMethod · 0.80
run_codeMethod · 0.80

Calls 3

funcFunction · 0.85
formatMethod · 0.45
showtracebackMethod · 0.45

Tested by 5

test_cb_errorMethod · 0.64
run_codeMethod · 0.64