MCPcopy Create free account
hub / github.com/microsoft/debugpy / on_response

Method on_response

src/debugpy/common/messaging.py:785–805  ·  view source on GitHub ↗

Registers a handler to invoke when a response is received for this request. The handler is invoked with Response as its sole argument. If response has already been received, invokes the handler immediately. It is guaranteed that self.response is set before the handler is in

(self, response_handler)

Source from the content-addressed store, hash-verified

783 return self.response.body
784
785 def on_response(self, response_handler):
786 """Registers a handler to invoke when a response is received for this request.
787 The handler is invoked with Response as its sole argument.
788
789 If response has already been received, invokes the handler immediately.
790
791 It is guaranteed that self.response is set before the handler is invoked.
792 If no response was received from the other party before the channel closed,
793 self.response is a dummy Response with body=NoMoreMessages().
794
795 The handler is always invoked asynchronously on an unspecified background
796 thread - thus, the caller of on_response() can never be blocked or deadlocked
797 by the handler.
798
799 No further incoming messages are processed until the handler returns, except for
800 responses to requests that have wait_for_response() invoked on them.
801 """
802
803 with self.channel:
804 self._response_handlers.append(response_handler)
805 self._enqueue_response_handlers()
806
807 def _enqueue_response_handlers(self):
808 response = self.response

Callers 4

evaluate_requestMethod · 0.80
send_requestMethod · 0.80
test_responsesMethod · 0.80

Calls 2

appendMethod · 0.45

Tested by 2

test_responsesMethod · 0.64