MCPcopy Index your code
hub / github.com/RustPython/RustPython / callback

Method callback

Lib/contextlib.py:534–545  ·  view source on GitHub ↗

Registers an arbitrary callback and arguments. Cannot suppress exceptions.

(self, callback, /, *args, **kwds)

Source from the content-addressed store, hash-verified

532 return result
533
534 def callback(self, callback, /, *args, **kwds):
535 """Registers an arbitrary callback and arguments.
536
537 Cannot suppress exceptions.
538 """
539 _exit_wrapper = self._create_cb_wrapper(callback, *args, **kwds)
540
541 # We changed the signature, so using @wraps is not appropriate, but
542 # setting __wrapped__ may still help with introspection.
543 _exit_wrapper.__wrapped__ = callback
544 self._push_exit_callback(_exit_wrapper)
545 return callback # Allow use as a decorator
546
547 def _push_cm_exit(self, cm, cm_exit):
548 """Helper to correctly register callbacks to __exit__ methods."""

Callers

nothing calls this directly

Calls 2

_create_cb_wrapperMethod · 0.95
_push_exit_callbackMethod · 0.95

Tested by

no test coverage detected