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

Function _payload

src/debugpy/common/messaging.py:411–431  ·  view source on GitHub ↗

JSON validator for message payload. If that value is missing or null, it is treated as if it were {}.

(value)

Source from the content-addressed store, hash-verified

409
410
411def _payload(value):
412 """JSON validator for message payload.
413
414 If that value is missing or null, it is treated as if it were {}.
415 """
416
417 if value is not None and value != ():
418 if isinstance(value, dict): # can be int, str, list...
419 assert isinstance(value, MessageDict)
420 return value
421
422 # Missing payload. Construct a dummy MessageDict, and make it look like it was
423 # deserialized. See JsonMessageChannel._parse_incoming_message for why it needs
424 # to have associate_with().
425
426 def associate_with(message):
427 value.message = message
428
429 value = MessageDict(None)
430 value.associate_with = associate_with
431 return value
432
433
434class Message(object):

Callers

nothing calls this directly

Calls 1

MessageDictClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…